Skip to content

Build and Publish (release/v2.10.0) #165

Build and Publish (release/v2.10.0)

Build and Publish (release/v2.10.0) #165

Workflow file for this run

name: Build and Publish
run-name: Build and Publish (${{ github.head_ref || github.ref }}) ${{ inputs.dry_run && '(🧪 Dry-Run)' || '' }}
on:
pull_request:
branches: [master]
types: [closed]
workflow_dispatch:
inputs:
dry_run:
description: "Dry run"
type: boolean
default: true
version:
description: "Release version (for example, v2.10.0)"
type: string
required: false
build_items:
description: "Build items"
type: choice
options:
- "ui,app,docker"
- "ui,app"
- "ui,docker"
- "app,docker"
- ui
- app
- docker
default: "ui,app,docker"
permissions:
contents: read
concurrency:
group: release-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false
jobs:
# Tag the release version code before building
# Getting the version code from the branch name or git ref.
tagging:
# Only run on manual trigger
# or when a PR is merged into master.
# (which the branch name start with `relase/`)
if: |
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true &&
github.event.pull_request.head.repo.full_name == github.repository &&
startsWith(github.head_ref, 'release/'))
uses: ./.github/workflows/build-tagging.yml
permissions:
contents: write
issues: write
pull-requests: write
with:
issue_number: ${{ github.event.pull_request.number || 0 }}
dry_run: ${{ inputs.dry_run || false }}
version: ${{ inputs.version || '' }}
# Build the UI
ui:
if: inputs.build_items == '' || contains(format(',{0},', inputs.build_items), ',ui,')
needs: tagging
uses: ./.github/workflows/build-ui.yml
with:
version: ${{ needs.tagging.outputs.version }}
ref: ${{ needs.tagging.outputs.ref }}
dry_run: ${{ inputs.dry_run || false }}
permissions:
contents: read
id-token: write
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Build the Docker image
docker:
if: inputs.build_items == '' || contains(format(',{0},', inputs.build_items), ',docker,')
needs: tagging
uses: ./.github/workflows/build-docker.yml
with:
version: ${{ needs.tagging.outputs.version }}
ref: ${{ needs.tagging.outputs.ref }}
dry_run: ${{ inputs.dry_run || false }}
permissions:
contents: read
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
# Build the binary app
app:
if: inputs.build_items == '' || contains(format(',{0},', inputs.build_items), ',app,')
needs: tagging
uses: ./.github/workflows/build-app.yml
with:
version: ${{ needs.tagging.outputs.version }}
ref: ${{ needs.tagging.outputs.ref }}
dry_run: ${{ inputs.dry_run || false }}
permissions:
contents: write
# All builds are complete
done:
needs: [tagging, ui, docker, app]
if: |
always() &&
needs.tagging.result == 'success' &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/build-done.yml
permissions:
contents: read
issues: write
pull-requests: write
with:
version: ${{ needs.tagging.outputs.version }}
ref: ${{ needs.tagging.outputs.ref }}
issue_number: ${{ github.event.pull_request.number || 0 }}
dry_run: ${{ inputs.dry_run || false }}