From bee265c82a08b1dcc8a3591db7f9d79c539cec0c Mon Sep 17 00:00:00 2001 From: Jan Koppe Date: Sun, 31 Oct 2021 08:50:23 +0100 Subject: [PATCH] add gh actions --- .github/workflows/build-and-publish.yml | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/build-and-publish.yml diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..37d7e9e --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,42 @@ +name: Build and Publish + +on: + push: + branches: + - 'main' + tags: + - 'v*' + pull_request: + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/${{ github.repository }} + + - name: Login to Github Packages + uses: docker/login-action@v1 + if: github.event_name != 'pull_request' + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name != 'pull_request'}} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file