Skip to content

Release Versions and Publish #4

Release Versions and Publish

Release Versions and Publish #4

name: Release Versions and Publish
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
# Ensure we are in publish mode by deleting any existing changesets.
# The next publish step will only run properly if no changesets are detected.
- name: Remove any new changesets since last versions
run: find .changeset -type f ! -name 'config.json' -delete
# 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 }}