Merge pull request #196 from ladesa-ro/changeset-release/development #121
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: Release | |
on: | |
push: | |
branches: | |
- development | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
NUGET_DIRECTORY: ${{ github.workspace}}/nuget | |
NUGET_PUSH_SERVER: https://api.nuget.org/v3/index.json | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
published-packages: ${{ steps.changesets.outputs.publishedPackages }} | |
publish-npm: "true" | |
publish-dotnet: "true" | |
permissions: | |
pages: read | |
issues: write | |
actions: write | |
statuses: write | |
contents: write | |
pull-requests: write | |
security-events: write | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.LADESA_BOT_ID }} | |
private-key: ${{ secrets.LADESA_BOT_SECRET }} | |
- name: Get GitHub App User ID | |
id: get-user-id | |
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
- run: | | |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' | |
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>' | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.app-token.outputs.token }} | |
- 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: false | |
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 }} | |
outputs: | |
runs-on: ubuntu-latest | |
needs: [release] | |
steps: | |
- name: print outputs (for debug purposes only) | |
run: echo '${{ toJSON(needs.release.outputs) }}' | |
publish-dotnet: | |
name: Publish to the NuGet registry | |
runs-on: ubuntu-latest | |
needs: [release] | |
if: needs.release.outputs.published == '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 }}" | |
publish-npm: | |
name: Publish to the NPM registry | |
runs-on: ubuntu-latest | |
needs: [release] | |
if: needs.release.outputs.published == 'true' | |
permissions: | |
actions: read | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Publish to the NPM registry | |
uses: ./.github/actions/publish/npm | |
with: | |
npm-token: "${{ secrets.NPM_TOKEN }}" |