|
| 1 | +name: Prerelease |
| 2 | + |
| 3 | +######################## |
| 4 | +### Release Pipeline ### |
| 5 | +######################## |
| 6 | +# This pipeline is triggered when a new tag is pushed to the repository. |
| 7 | +# This should usually be triggered by creating a GitHub Release in the repository. |
| 8 | +# We use a commitless release workflow, meaning no version numbers are written into |
| 9 | +# the repository. You can, therefore, tag any commit you want to make it a release. |
| 10 | +# |
| 11 | +# The pipeline generally consists of two stages: |
| 12 | +# 1. Test things to ensure we don't publish any broken code. |
| 13 | +# 2. Publish the code to the respective package registry or the like. |
| 14 | +# |
| 15 | +# These stages are applied to all libraries in this monorepo. |
| 16 | + |
| 17 | + |
| 18 | +# Only on release tags – prereleases get handled separately. |
| 19 | +on: |
| 20 | + push: |
| 21 | + tags: |
| 22 | + - "v[0-9]+.[0-9]+.[0-9]+-**" |
| 23 | + |
| 24 | +# Defines which tool versions should be used in all workflow jobs |
| 25 | +env: |
| 26 | + node: '22' |
| 27 | + pnpm: '9' |
| 28 | + |
| 29 | +# Add the necessary permissions: |
| 30 | +# - contents: write |
| 31 | +# - id-token: write for the publish-backend-deno job (JSR publishing) |
| 32 | +permissions: |
| 33 | + contents: write |
| 34 | + id-token: write |
| 35 | + |
| 36 | +jobs: |
| 37 | + #################### |
| 38 | + ### backend-deno ### |
| 39 | + #################### |
| 40 | + test-backend-deno: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + defaults: |
| 43 | + run: |
| 44 | + working-directory: ./backend-deno |
| 45 | + steps: |
| 46 | + - name: Checkout 📥 |
| 47 | + uses: actions/checkout@v3.6.0 |
| 48 | + - name: Setup Virtual Environment 🛠️ |
| 49 | + run: |- |
| 50 | + ../backend-features/tools/setup-venv.sh |
| 51 | + - name: Run Tests 🧪 |
| 52 | + run: |- |
| 53 | + . ../backend-features/.venv/bin/activate |
| 54 | + ../backend-features/run-tests.py -v . |
| 55 | + publish-backend-deno: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + needs: test-backend-deno |
| 58 | + defaults: |
| 59 | + run: |
| 60 | + working-directory: ./backend-deno |
| 61 | + steps: |
| 62 | + - name: Checkout 📥 |
| 63 | + uses: actions/checkout@v3.6.0 |
| 64 | + - name: Setup Deno |
| 65 | + uses: denolib/setup-deno@v2 |
| 66 | + with: |
| 67 | + deno-version: v2.x |
| 68 | + - name: Update version in `deno.json` |
| 69 | + run: | |
| 70 | + tag=${GITHUB_REF#refs/tags/} |
| 71 | + version=${tag#v} |
| 72 | + jq --arg version "$version" '.version = $version' deno.json > tmp.$$.json |
| 73 | + mv tmp.$$.json deno.json |
| 74 | + - name: Publish to JSR |
| 75 | + run: deno publish --allow-dirty |
| 76 | + ################## |
| 77 | + ### backend-go ### |
| 78 | + ################## |
| 79 | + test-backend-go: |
| 80 | + runs-on: ubuntu-latest |
| 81 | + defaults: |
| 82 | + run: |
| 83 | + working-directory: ./backend-go |
| 84 | + steps: |
| 85 | + - name: Checkout 📥 |
| 86 | + uses: actions/checkout@v3.6.0 |
| 87 | + - name: Setup Virtual Environment 🛠️ |
| 88 | + run: |- |
| 89 | + ../backend-features/tools/setup-venv.sh |
| 90 | + - name: Run Tests 🧪 |
| 91 | + run: |- |
| 92 | + . ../backend-features/.venv/bin/activate |
| 93 | + ../backend-features/run-tests.py -v . |
| 94 | + publish-backend-go: |
| 95 | + runs-on: ubuntu-latest |
| 96 | + needs: test-backend-go |
| 97 | + defaults: |
| 98 | + run: |
| 99 | + working-directory: ./backend-go |
| 100 | + steps: |
| 101 | + - name: Checkout 📥 |
| 102 | + uses: actions/checkout@v3.6.0 |
| 103 | + - name: Create Go Version Tag |
| 104 | + run: | |
| 105 | + tag=${GITHUB_REF#refs/tags/} |
| 106 | + git tag -a "backend-go/$tag" -m "Go Release $tag" |
| 107 | + git push origin "backend-go/$tag" |
| 108 | + ###################### |
| 109 | + ### frontend-react ### |
| 110 | + ###################### |
| 111 | + test-frontend-react: |
| 112 | + runs-on: ubuntu-latest |
| 113 | + defaults: |
| 114 | + run: |
| 115 | + working-directory: ./frontend-react |
| 116 | + steps: |
| 117 | + - name: Checkout 📥 |
| 118 | + uses: actions/checkout@v3.6.0 |
| 119 | + - name: Setup PNPM 💿 |
| 120 | + uses: pnpm/action-setup@v4 |
| 121 | + with: |
| 122 | + version: ${{ env.pnpm }} |
| 123 | + - name: Setup Node 💿 |
| 124 | + uses: actions/setup-node@v3.8.2 |
| 125 | + with: |
| 126 | + node-version: ${{ env.node }} |
| 127 | + cache: 'pnpm' |
| 128 | + cache-dependency-path: '**/pnpm-lock.yaml' |
| 129 | + - name: Install dependencies 📚 |
| 130 | + run: pnpm install |
| 131 | + - name: Run unit tests 🛃 |
| 132 | + run: | |
| 133 | + pnpm run ci:test |
| 134 | + publish-frontend-react: |
| 135 | + runs-on: ubuntu-latest |
| 136 | + needs: test-frontend-react |
| 137 | + defaults: |
| 138 | + run: |
| 139 | + working-directory: ./frontend-react |
| 140 | + steps: |
| 141 | + - name: Checkout 📥 |
| 142 | + uses: actions/checkout@v3.6.0 |
| 143 | + - name: Setup PNPM 💿 |
| 144 | + uses: pnpm/action-setup@v4 |
| 145 | + with: |
| 146 | + version: ${{ env.pnpm }} |
| 147 | + - name: Setup Node 💿 |
| 148 | + uses: actions/setup-node@v3.8.2 |
| 149 | + with: |
| 150 | + node-version: ${{ env.node }} |
| 151 | + cache: 'pnpm' |
| 152 | + cache-dependency-path: '**/pnpm-lock.yaml' |
| 153 | + - name: Install dependencies 📚 |
| 154 | + run: pnpm install |
| 155 | + - name: Build 🏗️ |
| 156 | + run: pnpm run build |
| 157 | + - name: Update version in `package.json` |
| 158 | + run: | |
| 159 | + tag=${GITHUB_REF#refs/tags/} |
| 160 | + version=${tag#v} |
| 161 | + jq --arg version "$version" '.version = $version' package.json > tmp.$$.json |
| 162 | + mv tmp.$$.json package.json |
| 163 | + - name: Publish to NPM 📦 |
| 164 | + run: pnpm publish --access public --no-git-checks --tag next |
| 165 | + env: |
| 166 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 167 | + NPM_CONFIG_PROVENANCE: true |
0 commit comments