Skip to content

Merge pull request #107 from unicef/nicpottier/step-status #15

Merge pull request #107 from unicef/nicpottier/step-status

Merge pull request #107 from unicef/nicpottier/step-status #15

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: "Version tag to release (e.g. v1.2.3)"
required: true
permissions:
contents: write
jobs:
desktop:
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: apps/desktop/src-tauri -> target
- name: Extract version from tag
id: version
shell: bash
run: |
REF="${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}"
VERSION="${REF#v}"
VERSION_MSI="${VERSION%%-*}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "version_msi=$VERSION_MSI" >> "$GITHUB_OUTPUT"
echo "tag=${REF}" >> "$GITHUB_OUTPUT"
- name: Set version in tauri.conf.json
shell: bash
run: |
node -e "
const fs = require('fs');
const p = 'apps/desktop/src-tauri/tauri.conf.json';
const conf = JSON.parse(fs.readFileSync(p, 'utf-8'));
conf.version = '${{ steps.version.outputs.version_msi }}';
fs.writeFileSync(p, JSON.stringify(conf, null, 2) + '\n');
"
- run: pnpm install --frozen-lockfile
- run: pnpm build
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: apps/desktop
args: --verbose
tagName: ${{ steps.version.outputs.tag }}
releaseName: "ADT Studio ${{ steps.version.outputs.tag }}"
releaseBody: ""
releaseDraft: false
prerelease: false
docker:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Extract tag
id: version
run: |
REF="${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}"
echo "tag=${REF}" >> "$GITHUB_OUTPUT"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
target: app
push: true
tags: |
ghcr.io/unicef/adt-studio:latest
ghcr.io/unicef/adt-studio:${{ steps.version.outputs.tag }}
- name: Ensure GitHub release exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.version.outputs.tag }}"
gh release view "$TAG" --repo ${{ github.repository }} 2>/dev/null || \
gh release create "$TAG" --repo ${{ github.repository }} --title "ADT Studio $TAG" --notes ""
- name: Generate standalone docker-compose.yml
run: |
TAG="${{ steps.version.outputs.tag }}"
sed "s/__TAG__/${TAG}/g" docker/compose-release.yml.template > docker-compose.yml
- name: Upload docker-compose.yml to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.version.outputs.tag }} docker-compose.yml \
--repo ${{ github.repository }} \
--clobber
- name: Generate release notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.version.outputs.tag }}"
NOTES=$(gh api repos/${{ github.repository }}/releases/generate-notes \
-f tag_name="$TAG" \
--jq '.body')
gh release edit "$TAG" --notes "$NOTES"