From 33587c5e928247a293534421879aa3ebad42db0e Mon Sep 17 00:00:00 2001 From: Nicolas Chan Date: Fri, 4 Jun 2021 00:07:55 -0700 Subject: [PATCH] Update CI to include release --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ab667b..03b3d61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,3 +58,33 @@ jobs: run: sudo apt-get install -y shellcheck - name: shellcheck run: shellcheck backup.sh + release: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + needs: [test, coverage, shellcheck] + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Create release + uses: ncipollo/release-action@v1.8.6 + with: + artifacts: "backup.sh" + token: ${{ secrets.GITHUB_TOKEN }} + docker: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + needs: [test, coverage, shellcheck] + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Build Docker image + run: | + docker build . --file Dockerfile --tag ghcr.io/nicolaschan/minecraft-backup:${GITHUB_REF#refs/*/} --tag ghcr.io/nicolaschan/minecraft-backup:latest + - name: Publish Docker image + run: | + echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin + docker push ghcr.io/nicolaschan/minecraft-backup:${GITHUB_REF#refs/*/} + docker push ghcr.io/nicolaschan/minecraft-backup:latest +