Merge pull request #216 from ladesa-ro/dev/gabriel #3
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: CI - Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- development | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
env: | |
NUGET_DIRECTORY: ${{ github.workspace}}/nuget | |
NUGET_PUSH_SERVER: https://api.nuget.org/v3/index.json | |
jobs: | |
code-quality: | |
uses: ./.github/workflows/quality.yml | |
release: | |
name: Release | |
needs: [code-quality] | |
runs-on: ubuntu-latest | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
published-packages: ${{ steps.changesets.outputs.publishedPackages }} | |
publish-npm: ${{ steps.changesets.outputs.published }} | |
ci_dotnet: ${{ steps.changesets.outputs.published }} | |
permissions: | |
pages: read | |
issues: write | |
actions: write | |
statuses: write | |
contents: write | |
pull-requests: write | |
security-events: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install | |
uses: ./.github/actions/prepare/install | |
with: | |
install-node: "true" | |
install-dotnet: "false" | |
- name: Run changesets action | |
uses: changesets/action@v1 | |
id: changesets | |
with: | |
setupGitUser: true | |
createGithubReleases: false | |
title: "chore: version packages" | |
commit: "chore: version packages" | |
publish: pnpm run -w changeset:tag | |
version: pnpm run -w changeset:version | |
env: | |
NPM_CONFIG_PROVENANCE: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ci_outputs: | |
name: Show the release job outputs | |
runs-on: ubuntu-latest | |
needs: [release] | |
steps: | |
- name: print outputs (for debug purposes only) | |
run: echo '${{ toJSON(needs.release.outputs) }}' | |
ci_dotnet: | |
name: Publish to the NuGet registry | |
runs-on: ubuntu-latest | |
needs: [release] | |
if: needs.release.outputs.published == 'true' && needs.release.outputs.ci_dotnet == 'true' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Publish to the NuGet registry | |
uses: ./.github/actions/publish/dotnet | |
with: | |
nuget-directory: "${{ env.NUGET_DIRECTORY }}" | |
nuget-push-server: "${{ env.NUGET_PUSH_SERVER }}" | |
nuget-token: "${{ secrets.NUGET_TOKEN }}" | |
ci_npm: | |
name: Publish to the NPM registry | |
runs-on: ubuntu-latest | |
needs: [release] | |
if: needs.release.outputs.published == 'true' && needs.release.outputs.publish-npm == 'true' | |
permissions: | |
actions: read | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract tag | |
id: extract-tag | |
run: | | |
TAG=latest | |
FILE=.changeset/pre.json | |
if [ -f ${FILE} ]; then | |
TAG=$(cat ${FILE} | jq .tag); | |
fi | |
echo tag: ${TAG} | |
echo "TAG=${TAG}" >> $GITHUB_OUTPUT | |
- name: Publish to the NPM registry | |
uses: ./.github/actions/publish/npm | |
with: | |
tag: "${{ steps.extract-tag.outputs.tag }}" | |
npm-token: "${{ secrets.NPM_TOKEN }}" |