From b9d950e0af71d862bf717d5427329ea9db8162cc Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Mon, 29 Mar 2021 20:43:13 +0200 Subject: [PATCH] Build and push a docker image to the GH registry For every push to master --- .github/workflows/main.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 38ab9d0..57e2173 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: test on: [push, pull_request] jobs: - build: + test: runs-on: ubuntu-latest strategy: matrix: @@ -26,3 +26,22 @@ jobs: - name: Test run: | poetry run pytest + + deploy: + needs: [test] + runs-on: ubuntu-latest + if: (github.repository == 'msys2/msys2-web' && github.event_name == 'push' && github.ref == 'refs/heads/master') + steps: + - uses: actions/checkout@v2 + - name: Log in + run: | + echo "$TOKEN" | docker login ghcr.io --username "$USERNAME" --password-stdin + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + USERNAME: ${{ github.actor }} + - name: Build image + run: | + docker build --tag ghcr.io/msys2/msys2-web:latest . + - name: Deploy image + run: | + docker push ghcr.io/msys2/msys2-web:latest \ No newline at end of file