From e58baeda90944d3550bab029aec662dcce242e64 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 11 Aug 2024 23:27:36 +0200 Subject: [PATCH] add build and push workflow --- .github/workflows/build-and-push.yml | 35 ++++++++++++++++++++++++++++ .github/workflows/lint.yml | 3 +++ .github/workflows/test.yml | 3 +++ 3 files changed, 41 insertions(+) create mode 100644 .github/workflows/build-and-push.yml diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 0000000..51ce406 --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,35 @@ +name: Build and Push Docker Image + +on: + push: + tags: + - 'v*' + +jobs: + build-and-push: + runs-on: ubuntu-latest + needs: [lint, test] + if: needs.lint.result == 'success' && needs.test.result == 'success' + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image with tags + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:${{ github.ref_name }} + ghcr.io/${{ github.repository_owner }}/${{ github.repository }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f5d520e..7f25e41 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,6 +10,9 @@ jobs: lint: runs-on: ubuntu-latest + outputs: + lint-status: ${{ steps.lint-check.conclusion }} + steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e9c24b..f936315 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,9 @@ jobs: test: runs-on: ubuntu-latest + outputs: + test-status: ${{ steps.test-check.conclusion }} + steps: - name: Checkout code uses: actions/checkout@v3