Workflow file for this run
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: buildTestPublishContainerDeploy | |
on: | |
release: | |
types: | |
- published | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
install-build-lint-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/[email protected] | |
with: | |
persist-credentials: false | |
- uses: actions/[email protected] | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
- name: Install, build, lint and test:e2e π§ | |
run: | | |
npm install | |
npm run build | |
npm run lint | |
npm run test:e2e | |
publish-container: | |
if: ${{ github.repository == 'bcgov/des-notifybc' && github.actor != 'renovate[bot]' }} | |
needs: install-build-lint-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/[email protected] | |
with: | |
persist-credentials: false | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/bcgov/des-notify-bc | |
tags: | | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish Container π | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: nodeVersion=${{ vars.NODE_VERSION }} | |
deploy: | |
if: ${{ github.repository == 'bcgov/des-notifybc' && github.event_name == 'push' }} | |
needs: publish-container | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/[email protected] | |
with: | |
persist-credentials: false | |
- name: Decrypt values.ocp4.dev.yaml.gpg | |
run: ./.github/scripts/decrypt_secret.sh | |
env: | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Install oc | |
uses: redhat-actions/oc-installer@v1 | |
- name: Authenticate to OCP4 and set context | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_URL }} | |
openshift_token: ${{ secrets.OPENSHIFT_API_TOKEN }} | |
namespace: ${{ secrets.OPENSHIFT_PROJECT }}-dev | |
- name: Download notifyBCContainerTag | |
uses: actions/download-artifact@v2 | |
with: | |
name: notifyBCContainerTag | |
- name: helm upgrade π | |
run: | | |
export notifyBCContainerTag=`cat notifyBCContainerTag.txt` | |
helm upgrade -f helm/platform-specific/openshift.yaml \ | |
-f .github/values.ocp4.dev.yaml --set \ | |
image.tag="$notifyBCContainerTag" `helm ls -q` helm | |
oc get deployment -o name | xargs oc rollout restart |