Skip to content

Commit

Permalink
GitHub Action to publish docker images (#1096)
Browse files Browse the repository at this point in the history
  • Loading branch information
DCjanus authored May 13, 2024
1 parent b0b7a38 commit 1770db0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Docker Images

on:
push:
branches:
- master
tags:
- v*

jobs:
image:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
steps:
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check out the repo
uses: actions/checkout@v4
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{raw}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} earthly --ci --push +docker --image_name="{}"
7 changes: 4 additions & 3 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
VERSION 0.6
FROM alpine:3.14
FROM alpine:3.19
WORKDIR /src

build:
FROM rust:alpine3.14
FROM rust:alpine3.19
RUN apk update \
&& apk add \
git \
Expand All @@ -21,4 +21,5 @@ docker:
WORKDIR /src
ENTRYPOINT [ "tokei" ]
CMD [ "--help" ]
SAVE IMAGE tokei
ARG image_name=tokei:latest
SAVE IMAGE --push $image_name
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
![](https://img.shields.io/crates/d/tokei?label=downloads%20%28crates.io%29)
![](https://img.shields.io/github/downloads/xampprocky/tokei/total?label=downloads%20%28GH%29)
![](https://img.shields.io/homebrew/installs/dy/tokei?color=brightgreen&label=downloads%20%28brew%29)
[![dependency status](https://deps.rs/repo/github/XAMPPRocky/tokei/status.svg)](https://deps.rs/repo/github/XAMPPRocky/tokei)

Tokei is a program that displays statistics about your code. Tokei will show the number of files, total lines within those files and code, comments, and blanks grouped by language.

Expand Down

0 comments on commit 1770db0

Please sign in to comment.