From a5296eea555b9ad2b21c047a66abda839c5e7254 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Fri, 4 Dec 2020 16:30:42 +0000 Subject: [PATCH] Create build.yml --- .github/workflows/build.yml | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5a26031 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,53 @@ +name: Build +on: + push: + branches: main + +jobs: + release-on-push: + runs-on: ubuntu-latest + outputs: + ver: ${{ steps.release.outputs.version }} + tag: ${{ steps.release.outputs.tag_name }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - id: release + uses: rymndhng/release-on-push-action@master + with: + bump_version_scheme: norelease + + - name: Check Output Parameters + run: | + echo "Got tag name ${{ steps.release.outputs.tag_name }}" + echo "Got release version ${{ steps.release.outputs.version }}" + + docker-dh: + name: Push to Docker Hub + needs: [release-on-push] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Login to DockerHub Registry + run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin + - name: Build image for Docker Hub + run: docker build . --file Dockerfile --build-arg VERSION=${{ needs.release-on-push.outputs.ver }} --tag luketainton/hesk-docker:${{ needs.release-on-push.outputs.tag }} --tag luketainton/hesk-docker:latest + - name: Push image to Docker Hub + run: | + docker push luketainton/hesk-docker:${{ needs.release-on-push.outputs.tag }} && + docker push luketainton/hesk-docker:latest + + docker-ghr: + name: Push to GitHub Package Registry + needs: [release-on-push] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Login to DockerHub Registry + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u luketainton --password-stdin + - name: Build image for GitHub Package Registry + run: docker build . --file Dockerfile --build-arg VERSION=${{ needs.release-on-push.outputs.ver }} --tag docker.pkg.github.com/luketainton/hesk-docker/hesk-docker:latest --tag docker.pkg.github.com/luketainton/hesk-docker/hesk-docker:${{ needs.release-on-push.outputs.tag }} + - name: Push image to GitHub Package Registry + run: | + docker push docker.pkg.github.com/luketainton/hesk-docker/hesk-docker:${{ needs.release-on-push.outputs.tag }} && + docker push docker.pkg.github.com/luketainton/hesk-docker/hesk-docker:latest