From c99dc35a05a9affeef5c0ef1825aa45079951a06 Mon Sep 17 00:00:00 2001 From: Nanjiang Shu Date: Wed, 2 Aug 2023 11:39:24 +0200 Subject: [PATCH] add github action yaml file --- .github/workflows/tag_and_build.yml | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/tag_and_build.yml diff --git a/.github/workflows/tag_and_build.yml b/.github/workflows/tag_and_build.yml new file mode 100644 index 0000000..a875747 --- /dev/null +++ b/.github/workflows/tag_and_build.yml @@ -0,0 +1,35 @@ +name: Build and push Docker image +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build image + uses: docker/build-push-action@v4 + with: + context: + file: ./Dockerfile + push: true + tags: | + ghcr.io/shinynbis:latest + ghcr.io/shinynbis:${{ needs.tag.outputs.tag }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.clone_url }} + org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ') + org.opencontainers.image.revision=${{ github.sha }} +