Merge pull request #260 from fedimod/dependabot/npm_and_yarn/rollup-4… #178
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| outputs: | |
| published: ${{ steps.changesets.outputs.published }} | |
| matrix: ${{ steps.release.outputs.matrix }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v6 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: "pnpm" | |
| - name: Install Dependencies | |
| run: pnpm install | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| title: Prepare releases | |
| commit: prepare releases | |
| version: pnpm ci:version | |
| publish: pnpm ci:release | |
| createGithubReleases: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Setup release variables | |
| id: release | |
| run: | | |
| echo '${{steps.changesets.outputs.publishedPackages}}' | |
| packages=$(jq -cr '[.[] | select( [ .name | contains("fires-server") ] | any)]' <<< '${{ steps.changesets.outputs.publishedPackages }}') | |
| release_matrix=$(jq -cr '{ include: . | map({ tag: ("refs/tags/" + .name + "@" + .version), version: .version, package: (.name | ltrimstr("@fedimod/")) }) }' <<< $packages) | |
| echo "matrix=${release_matrix%,}" >> "$GITHUB_OUTPUT" | |
| release-fires-server-image: | |
| needs: [release] | |
| strategy: | |
| matrix: ${{ fromJson(needs.release.outputs.matrix) }} | |
| if: ${{ needs.release.outputs.published == 'true' && needs.release.outputs.matrix != '{"include":[]}' }} | |
| uses: ./.github/workflows/build-container-image.yml | |
| with: | |
| git_ref: ${{ matrix.tag }} | |
| file_to_build: Dockerfile | |
| target_stage: ${{ matrix.package }} | |
| push_to_images: | | |
| ghcr.io/fedimod/${{ matrix.package }} | |
| # Do not use cache when building releases, so apk update is always ran and the release always contain the latest packages | |
| cache: false | |
| # Only tag with latest when ran against the latest stable branch | |
| # This needs to be updated after each minor version release | |
| flavor: | | |
| latest=true | |
| tags: | | |
| type=semver,pattern={{version}},value=${{matrix.version}} | |
| type=semver,pattern={{major}}.{{minor}},value=${{matrix.version}} | |
| secrets: inherit |