mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-07-30 11:43:26 +08:00
117 lines
3.8 KiB
YAML
117 lines
3.8 KiB
YAML
name: release-skills
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ['skills/**']
|
|
workflow_dispatch:
|
|
inputs:
|
|
ref:
|
|
description: "Branch or tag to release from (must be main)"
|
|
required: false
|
|
default: main
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
skipped: ${{ steps.changelog.outputs.skipped }}
|
|
version: ${{ steps.changelog.outputs.version }}
|
|
steps:
|
|
- name: Require main branch
|
|
if: github.event_name == 'workflow_dispatch'
|
|
run: |
|
|
if [ "${{ github.ref_name }}" != "main" ]; then
|
|
echo "Releases must be run from the main branch (got '${{ github.ref_name }}')."
|
|
exit 1
|
|
fi
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.IDEE_GH_TOKEN }}
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
|
|
- run: npm ci
|
|
|
|
- name: Validate skills
|
|
run: npm run validate:skills
|
|
|
|
- name: Conventional Changelog Action
|
|
id: changelog
|
|
uses: TriPSs/conventional-changelog-action@v5
|
|
with:
|
|
git-user-name: svc-idee-bot
|
|
git-user-email: svc_idee_bot@salesforce.com
|
|
github-token: ${{ secrets.IDEE_GH_TOKEN }}
|
|
tag-prefix: ""
|
|
release-count: "0"
|
|
skip-on-empty: ${{ github.event_name == 'push' }}
|
|
version-file: "package.json"
|
|
output-file: "CHANGELOG.md"
|
|
git-push: "false"
|
|
|
|
- name: Report validate-skills status on release commit
|
|
if: ${{ steps.changelog.outputs.skipped == 'false' }}
|
|
env:
|
|
GH_TOKEN: ${{ secrets.IDEE_GH_TOKEN }}
|
|
run: |
|
|
SHA=$(git rev-parse HEAD)
|
|
gh api "repos/${{ github.repository }}/statuses/$SHA" \
|
|
-f state=success \
|
|
-f context=validate-skills \
|
|
-f description="Validated in release workflow"
|
|
|
|
- name: Verify tag does not already exist
|
|
if: ${{ steps.changelog.outputs.skipped == 'false' }}
|
|
run: |
|
|
TAG="${{ steps.changelog.outputs.tag }}"
|
|
if git ls-remote --tags origin | grep -q "refs/tags/$TAG$"; then
|
|
echo "::error::Tag $TAG already exists on remote. Delete it first if re-releasing: git push --delete origin $TAG"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Push release commit and tag
|
|
if: ${{ steps.changelog.outputs.skipped == 'false' }}
|
|
run: git push origin main --follow-tags
|
|
|
|
- name: Create Github Release
|
|
id: release
|
|
uses: ncipollo/release-action@v1
|
|
if: ${{ steps.changelog.outputs.skipped == 'false' }}
|
|
with:
|
|
name: "${{ steps.changelog.outputs.version }}"
|
|
tag: "${{ steps.changelog.outputs.version }}"
|
|
commit: ${{ github.sha }}
|
|
body: |
|
|
## Changes in @salesforce/afv-skills
|
|
|
|
${{ steps.changelog.outputs.clean_changelog }}
|
|
token: ${{ secrets.IDEE_GH_TOKEN }}
|
|
skipIfReleaseExists: true
|
|
|
|
- name: Publish to npm
|
|
id: publish
|
|
if: ${{ steps.changelog.outputs.skipped == 'false' && steps.release.outputs.id != '' }}
|
|
run: |
|
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
|
npm publish --access public
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Notify cline-fork
|
|
if: ${{ steps.changelog.outputs.skipped == 'false' && steps.release.outputs.id != '' && steps.publish.outcome == 'success' }}
|
|
uses: peter-evans/repository-dispatch@v3
|
|
with:
|
|
token: ${{ secrets.IDEE_GH_TOKEN }}
|
|
repository: forcedotcom/cline-fork
|
|
event-type: skills-released
|
|
client-payload: '{"version": "${{ steps.changelog.outputs.version }}"}'
|