Merge pull request #23 from i4Trust/siop-token-only #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
env: | |
IMAGE_NAME: i4trust/pdc-portal | |
IMAGE_NAME_QUAY: quay.io/i4trust/pdc-portal | |
jobs: | |
generate-version: | |
name: Generate version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.out.outputs.version }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: pr | |
uses: actions-ecosystem/action-get-merged-pull-request@v1.0.1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: zwaldowski/semver-release-action@v2 | |
with: | |
dry_run: true | |
bump: ${{ steps.pr.outputs.labels }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set version output | |
id: out | |
run: echo "::set-output name=version::$(echo ${VERSION})" | |
git-release: | |
name: Git release | |
needs: ["generate-version"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: ${{ needs.generate-version.outputs.version }} | |
title: ${{ needs.generate-version.outputs.version }} | |
prerelease: false | |
files: | | |
LICENSE | |
docker-release: | |
name: Docker build and release | |
needs: ["git-release", "generate-version"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Log into registry | |
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
run: | | |
docker build --tag ${{ env.IMAGE_NAME }}:${{ needs.generate-version.outputs.version }} . | |
docker push ${{ env.IMAGE_NAME }}:${{ needs.generate-version.outputs.version }} | |
- name: Push to quay.io | |
run: | | |
echo "${{ secrets.QUAY_TOKEN }}" | docker login quay.io -u "${{ secrets.QUAY_USERNAME }}" --password-stdin | |
docker tag ${{ env.IMAGE_NAME }}:${{ needs.generate-version.outputs.version }} ${{ env.IMAGE_NAME_QUAY }}:${{ needs.generate-version.outputs.version }} | |
docker push ${{ env.IMAGE_NAME_QUAY }}:${{ needs.generate-version.outputs.version }} | |