Repository navigation
Release #23
Workflow file for this run
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: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g. 1.3.0 or 1.3.0-beta.0)' | |
| required: true | |
| type: string | |
| jobs: | |
| publish-docker: | |
| runs-on: ubuntu-latest | |
| environment: Production | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout tag | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| ref: v${{ inputs.version }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | |
| - name: Docker meta | |
| id: docker_meta | |
| uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository }} | |
| hirosystems/${{ github.event.repository.name }} | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ inputs.version }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ inputs.version }} | |
| type=semver,pattern={{major}},value=${{ inputs.version }} | |
| type=raw,value=latest,enable=${{ !contains(inputs.version, '-') }} | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to DockerHub | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| username: ${{ secrets.HIROSYSTEMS_DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.HIROSYSTEMS_DOCKERHUB_TOKEN }} | |
| - name: Build/Tag/Push Image | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.docker_meta.outputs.tags }} | |
| labels: ${{ steps.docker_meta.outputs.labels }} | |
| push: true | |
| publish-npm: | |
| needs: publish-docker | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout tag | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| ref: v${{ inputs.version }} | |
| - name: Use Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Install deps | |
| run: npm ci --audit=false | |
| - name: Install client deps | |
| run: npm ci --audit=false | |
| working-directory: client | |
| - name: Publish client to npm | |
| working-directory: client | |
| run: | | |
| VERSION="${{ inputs.version }}" | |
| if [[ "$VERSION" == *-* ]]; then | |
| # Extract the prerelease identifier (e.g. "next" from "9.0.0-next.30") | |
| TAG="${VERSION#*-}" | |
| TAG="${TAG%%.*}" | |
| npm publish --provenance --access public --tag "$TAG" | |
| else | |
| npm publish --provenance --access public | |
| fi | |
| github-release: | |
| needs: publish-npm | |
| if: github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout tag | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| ref: v${{ inputs.version }} | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| PRERELEASE_FLAG="" | |
| if echo "${{ inputs.version }}" | grep -q "-"; then | |
| PRERELEASE_FLAG="--prerelease" | |
| fi | |
| gh release create "v${{ inputs.version }}" \ | |
| --draft \ | |
| --generate-notes \ | |
| $PRERELEASE_FLAG |