Skip to content

πŸš€ Release + Publish #95

πŸš€ Release + Publish

πŸš€ Release + Publish #95

Workflow file for this run

name: πŸš€ Release + Publish
on: [workflow_dispatch]
permissions:
id-token: write
contents: write
attestations: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: βœ… Use App Token for the Bot which is allowed to create releases
uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: πŸ“₯ Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# Required for fetching tags and generating release notes
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- name: πŸ”§ Setup Bun
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2
with:
bun-version-file: ".bun-version"
- name: πŸ“¦ Install dependencies
run: |
bun install --frozen-lockfile
- name: πŸ”§ Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git config --global push.followTags true
- name: πŸš€ Prepare release
run: bun run preversion
- name: πŸ“œ Generate changelog and release notes
env:
# Don't run husky on `git commit`
HUSKY: 0
run: |
bunx changelogen --hideAuthorEmail --release --push
bunx changelogen github release --token ${{ secrets.GITHUB_TOKEN }}
- name: πŸ“ Get metadata
run: |
VERSION=$(jq -r '.version' package.json)
NAME=$(jq -r '.name' package.json)
EXTENSION_FILE="${NAME}-${VERSION}.vsix"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "EXTENSION_FILE=$EXTENSION_FILE" >> $GITHUB_ENV
- name: πŸ› οΈ Build extension
run: bunx @vscode/vsce package
- name: πŸ”’ Attest artifacts
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
# Read: https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds
with:
subject-path: ${{ env.EXTENSION_FILE }}
- name: 🌐 Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@ca5561daa085dee804bf9f37fe0165785a9b14db # v2.0.0
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ${{ env.EXTENSION_FILE }}
- name: 🌐 Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@ca5561daa085dee804bf9f37fe0165785a9b14db # v2.0.0
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: ${{ env.EXTENSION_FILE }}
- name: πŸ“¦ Publish to NPM Registry
run: |
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
npm publish --provenance --access public
- name: ⬆️ Upload VSIX to GitHub release
run: |
gh release upload v$VERSION $EXTENSION_FILE
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}