Release #6
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: | |
workflow_dispatch: | |
inputs: | |
incrementType: | |
description: "Type of increment (see: semver.org)" | |
required: true | |
default: "patch" | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
set-version: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
outputs: | |
version_tag: ${{steps.npm_version.outputs.tag}} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Send Discord Notification | |
uses: sarisia/actions-status-discord@v1 | |
if: always() | |
with: | |
webhook: ${{ secrets.DISCORD_GITHUB_CHANNEL_WEBHOOK }} | |
title: "Release toolbox: Starting" | |
description: "Release toolbox (client + server) with proper semver and deploy on staging." | |
color: 0xffed2b | |
username: GitHub Actions | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Git Identity | |
run: | | |
git config --global user.name 'geovbot' | |
git config --global user.email '[email protected]' | |
git remote set-url origin https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "16.13.2" | |
registry-url: "https://registry.npmjs.org" | |
- name: Create version number | |
id: npm_version | |
run: | | |
npm version ${{ github.event.inputs.incrementType }} --no-git-tag-version | |
echo ::set-output name=tag::$(cat ./package.json | jq -r '.version') | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Echo tag created by npm | |
run: echo your tag is '${{steps.npm_version.outputs.tag}}' | |
- name: Update Lock file | |
run: "npm i --package-lock-only" | |
- uses: EndBug/add-and-commit@v5 | |
with: | |
message: "chore(): update release version" | |
tag: v${{steps.npm_version.outputs.tag}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
dockerize-webserver: | |
runs-on: ubuntu-latest | |
needs: [set-version] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Build & Push | |
uses: docker/build-push-action@v3 | |
with: | |
# Location of Dockerfile, if not Dockerfile in root directory | |
file: server/webserver.dockerfile | |
# Directory to run `docker build` from, if not project root | |
context: server | |
push: true | |
tags: ghcr.io/geovistory/toolbox-server:${{needs.set-version.outputs.version_tag}} | |
- name: Send Discord Notification | |
uses: sarisia/actions-status-discord@v1 | |
if: always() | |
with: | |
webhook: ${{ secrets.DISCORD_GITHUB_CHANNEL_WEBHOOK }} | |
title: "Release > Dockerize Toolbox Server > Done" | |
description: "Image Tag: ${{needs.set-version.outputs.version_tag}}" | |
color: 0x0000ff | |
username: GitHub Actions | |
dockerize-client: | |
runs-on: ubuntu-latest | |
needs: [set-version] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Build & Push | |
uses: docker/build-push-action@v3 | |
with: | |
# Location of Dockerfile, if not Dockerfile in root directory | |
file: client/Dockerfile | |
# Directory to run `docker build` from, if not project root | |
context: client | |
push: true | |
tags: ghcr.io/geovistory/toolbox-client:${{needs.set-version.outputs.version_tag}} | |
- name: Send Discord Notification | |
uses: sarisia/actions-status-discord@v1 | |
if: always() | |
with: | |
webhook: ${{ secrets.DISCORD_GITHUB_CHANNEL_WEBHOOK }} | |
title: "Release > Dockerize Toolbox Client > Done" | |
description: "Image Tag: ${{needs.set-version.outputs.version_tag}}" | |
color: 0x0000ff | |
username: GitHub Actions | |
release: | |
needs: [set-version, dockerize-client, dockerize-webserver] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Invoke workflow in public-chart to make a staging release | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: update-docker-image-tag | |
repo: geovistory/public-chart | |
ref: stag | |
token: ${{ secrets.GEOVBOT_PAT_REPO }} | |
inputs: | | |
{ | |
"service": "toolbox", | |
"tag": "${{needs.set-version.outputs.version_tag}}", | |
"environment": "stag" | |
} | |
- name: Send Discord Notification | |
uses: sarisia/actions-status-discord@v1 | |
if: always() | |
with: | |
webhook: ${{ secrets.DISCORD_GITHUB_CHANNEL_WEBHOOK }} | |
title: "Release toolbox (on stag): Done" | |
description: "" | |
color: 0x0000ff | |
username: GitHub Actions |