From 7b1d7acd377acee382be6af11fec02c78719c195 Mon Sep 17 00:00:00 2001 From: Alex Freska Date: Wed, 18 Dec 2024 10:06:43 -0500 Subject: [PATCH] ci: add manual release workflow --- .github/workflows/release-main.yml | 2 +- .github/workflows/release-manual.yml | 100 +++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-manual.yml diff --git a/.github/workflows/release-main.yml b/.github/workflows/release-main.yml index c77c9e5d9..c01b28370 100644 --- a/.github/workflows/release-main.yml +++ b/.github/workflows/release-main.yml @@ -1,4 +1,4 @@ -name: Release Versions or Publish NPM +name: Update Release PR or Release Versions and Publish on: push: diff --git a/.github/workflows/release-manual.yml b/.github/workflows/release-manual.yml new file mode 100644 index 000000000..905692666 --- /dev/null +++ b/.github/workflows/release-manual.yml @@ -0,0 +1,100 @@ +name: Release Versions and Publish NPM + +on: + workflow_dispatch: + +# This is for .npmrc. Nx automatically creates an .npmrc before changesets runs +# and creates one itself, so we need to explicitly have one. +env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + +concurrency: commits-to-main + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout all commits + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup + uses: ./.github/actions/setup-all + with: + node_version: 20.10.0 + go_version: 1.23.0 + # The SDK is referenced via dist in the tsconfig.base.json + # because the next executor does not actually support + # buildLibsFromSource=false + # With this configuration NX does not build the SDK as expected + # when it is an app dependency + - name: Force build SDK + shell: bash + run: npx nx run sdk:build + - name: Build for publishing + shell: bash + run: npx nx run-many --target=build --configuration=production --all --parallel=5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + CCRI_TOKEN: ${{ secrets.CCRI_TOKEN }} + - name: Replace src code with dists for publishing + run: ./scripts/replace-src-with-dists-for-publishing.sh + # If no changesets were detected in the PR prep step then we are in + # release/publish mode. Check for and publish any new versions to NPM. + - name: Publish to NPM and create GitHub releases + id: changesets_release + uses: changesets/action@v1 + with: + publish: npm run release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Release Go modules + # if a release was published, release the Go modules + if: steps.changesets_release.outputs.published == 'true' + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.PAT_REPOSITORY_DISPATCH }} + repository: siafoundation/web + event-type: release-go + release-docker: + runs-on: ubuntu-latest + steps: + - name: Checkout all commits + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup + uses: ./.github/actions/setup-all + with: + node_version: 20.10.0 + go_version: 1.23.0 + - uses: docker/setup-buildx-action@v2 + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + # The SDK is referenced via dist in the tsconfig.base.json + # because the next executor does not actually support + # buildLibsFromSource=false + # With this configuration NX does not build the SDK as expected + # when it is an app dependency + - name: Force build SDK + shell: bash + run: npx nx run sdk:build + - name: Containers + shell: bash + run: npx nx run-many --target=container --configuration=production -all --parallel=5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + CCRI_TOKEN: ${{ secrets.CCRI_TOKEN }} + - name: Containers zen + shell: bash + run: npx nx run-many --target=container --configuration=production-testnet-zen -all --parallel=5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + CCRI_TOKEN: ${{ secrets.CCRI_TOKEN }}