Publish release #9
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: Publish release | |
on: | |
workflow_dispatch: | |
inputs: | |
branch_name: | |
description: Branch to build from | |
default: master | |
required: true | |
release_version: | |
description: Release tag. It will be prepended by your repository name | |
required: true | |
jobs: | |
base: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: '${{ github.event.inputs.branch_name }}' | |
- name: Install jq | |
run: sudo apt-get install jq -y | |
- name: Read version from package.json | |
id: get_version | |
run: echo "::set-output name=version::$(jq -r '.version' package.json)" | |
- name: Set TAG environment variable | |
run: echo "TAG=v${{ steps.get_version.outputs.version }}" >> $GITHUB_ENV | |
- uses: trstringer/manual-approval@v1 | |
with: | |
secret: ${{ github.TOKEN }} | |
approvers: euanmillar,rikukissa | |
minimum-approvals: 1 | |
issue-title: 'Release: ${{ env.TAG }}' | |
issue-body: 'Please approve or deny the publishing of release: ${{ env.TAG }} to Dockerhub' | |
exclude-workflow-initiator-as-approver: false | |
- name: Push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag_prefix: ${{ github.event.repository.name }}- | |
custom_tag: ${{ env.TAG }} | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Push image | |
env: | |
DOCKERHUB_ACCOUNT: ${{ secrets.DOCKERHUB_ACCOUNT }} | |
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO }} | |
run: | | |
export COUNTRY_CONFIG_VERSION=${{ env.TAG }} | |
echo "Publishing a Docker image with a tag $COUNTRY_CONFIG_VERSION" | |
bash build-and-push.sh && unset COUNTRY_CONFIG_VERSION | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.TAG }} | |
name: Release ${{ env.TAG }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
- name: Merge ${{ github.event.inputs.branch_name }} -> master | |
uses: devmasx/merge-branch@master | |
with: | |
type: now | |
from_branch: ${{ github.event.inputs.branch_name }} | |
target_branch: master | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Merge master -> develop | |
uses: devmasx/merge-branch@master | |
with: | |
type: now | |
from_branch: master | |
target_branch: develop | |
github_token: ${{ secrets.GITHUB_TOKEN }} |