Merge pull request #1000 from bcgov/test #85
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: Create Release | |
on: | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
REGISTRY_USERNAME: ${{ secrets.CONTAINER_REGISTRY_USERNAME }} | |
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} | |
jobs: | |
release-on-push: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.REGISTRY_USERNAME }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
- id: release | |
uses: rymndhng/release-on-push-action@v0.20.0 | |
with: | |
bump_version_scheme: patch | |
- name: Check Output Parameters | |
run: | | |
echo "Tag Name ${{ steps.release.outputs.tag_name }}" | |
echo "Version ${{ steps.release.outputs.version }}" | |
echo "Revision ${GITHUB_SHA}" | |
- name: Set DEPLOY_ID | |
run: | | |
echo "::set-output name=APP_REVISION::${GITHUB_SHA}" | |
id: set-deploy-id | |
- uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build Portal | |
uses: docker/build-push-action@v2 | |
with: | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
context: . | |
file: Dockerfile | |
tags: ${{ env.REGISTRY }}/bcgov/api-services-portal/api-services-portal:${{ steps.release.outputs.tag_name }} | |
push: true | |
build-args: | | |
GITHUB_API_TOKEN=${{ secrets.CONTAINER_REGISTRY_PASSWORD }} | |
APP_VERSION=${{ steps.release.outputs.version }} | |
APP_REVISION=${{ steps.set-deploy-id.outputs.APP_REVISION }} | |
- name: Build Feeder | |
uses: docker/build-push-action@v2 | |
with: | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
context: ./feeds | |
file: ./feeds/Dockerfile | |
tags: ${{ env.REGISTRY }}/bcgov/api-services-portal/data-feeder:${{ steps.release.outputs.tag_name }} | |
push: true | |
build-args: | | |
GITHUB_API_TOKEN=${{ secrets.CONTAINER_REGISTRY_PASSWORD }} | |
APP_VERSION=${{ steps.release.outputs.version }} | |
APP_REVISION=${{ steps.set-deploy-id.outputs.APP_REVISION }} |