GitHub Action to publish docker images (#1096)

This commit is contained in:
DCjanus 2024-05-13 22:13:58 +08:00 committed by GitHub
parent b0b7a38025
commit 1770db0afd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 3 deletions

41
.github/workflows/publish_image.yaml vendored Normal file
View file

@ -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="{}"

View file

@ -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 \
@ -21,4 +21,5 @@ docker:
WORKDIR /src
ENTRYPOINT [ "tokei" ]
CMD [ "--help" ]
SAVE IMAGE tokei
ARG image_name=tokei:latest
SAVE IMAGE --push $image_name

View file

@ -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.