cache-apt-pkgs-action/.github/workflows/release.yml

86 lines
2.4 KiB
YAML

name: Publish
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
description: "Release tag (for example v0.2.0)"
required: true
type: string
jobs:
validate:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [24]
env:
RELEASE_TAG: ${{ github.ref_type == 'tag' && github.ref_name || inputs.tag }}
steps:
- name: Checkout repository
uses: "actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0" # v7.0.0
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Release preflight (tag/version)
run: npm run release:preflight
- name: Check code health
uses: ./.github/actions/codehealth
publish:
runs-on: ubuntu-latest
needs: validate
permissions:
contents: write
id-token: write
steps:
- name: Checkout repository
uses: "actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0" # v7.0.0
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Build package
run: npm run build
- name: Resolve npm dist-tag
run: |
TAG="${{ github.ref_type == 'tag' && github.ref_name || inputs.tag }}"
if [[ "$TAG" == *-* ]]; then
echo "NPM_DIST_TAG=next" >> "$GITHUB_ENV"
else
echo "NPM_DIST_TAG=latest" >> "$GITHUB_ENV"
fi
- name: Generate API docs
run: npm run docs:api
- name: Publish to npm
run: npm publish --access public --provenance --tag "$NPM_DIST_TAG"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub release
uses: "softprops/action-gh-release@2bb465e97f322d3cb2a965294d483e0d26a67aa9" # v3.0.1
with:
generate_release_notes: true
tag_name: ${{ github.ref_type == 'tag' && github.ref_name || inputs.tag }}
- name: Setup Pages
uses: "actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d" # v6.0.0
- name: Upload Pages artifact
uses: "actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9" # v5.0.0
with:
path: docs/api
- name: Deploy to GitHub Pages
id: deployment
uses: "actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128" # v5.0.0