Skip to content

chore: make setting prerelease a chore not fix #1037

chore: make setting prerelease a chore not fix

chore: make setting prerelease a chore not fix #1037

name: ' 🚀 Generate Release Please'
on:
workflow_dispatch:
push:
branches:
- main
permissions:
actions: read
checks: write
contents: write
issues: read
packages: write
pull-requests: write
repository-projects: read
statuses: read
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
version: ${{ steps.release.outputs.version }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
- name: Release Please Results
env:
RESULTS: ${{ toJSON(steps.release.outputs) }}
run: echo "$RESULTS"
- name: Checkout code
if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@v4
- name: tag versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/streetsidesoftware/vscode-spell-checker.git"
git tag -a v${{ steps.release.outputs.version }} -m "Release v${{ steps.release.outputs.version }}"
git push origin v${{ steps.release.outputs.version }}
result:
runs-on: ubuntu-latest
needs:
- release-please
steps:
- name: Summary Info
uses: streetsidesoftware/actions/public/summary@v1
with:
text: |
# Release Please Results
Release Created: ${{ needs.release-please.outputs.release_created || 'false' }}
Results:
```json
${{ toJSON(needs.release-please.outputs) }}
```
assets:
needs:
- release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/release-assets.yml
with:
ref: ${{ needs.release-please.outputs.tag_name }}
mark-prerelease:
needs:
- release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/release-mark-prerelease.yml
with:
ref: ${{ needs.release-please.outputs.tag_name }}
publish:
needs:
- release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/manual-publish.yml
with:
ref: ${{ needs.release-please.outputs.tag_name }}
secrets:
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
label:
runs-on: ubuntu-latest
needs:
- release-please
if: ${{ !needs.release-please.outputs.release_created }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Find PR
id: find-pr
uses: actions/github-script@v7
with:
script: |
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: context.sha
});
const found = prs.filter(pr => pr.title.startsWith('chore(main): release code-spell-checker'))
return found[0]?.number || '';
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Mode
id: prerelease-mode
uses: ./.github/actions/is-prerelease
- name: Label PR
if: ${{ steps.find-pr.outputs.result }}
env:
LABEL_ADD: ${{ steps.prerelease-mode.outputs.prerelease == 'true' && 'Prerelease' || 'Release' }}
LABEL_REMOVE: ${{ steps.prerelease-mode.outputs.prerelease == 'true' && 'Release' || 'Prerelease' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ steps.find-pr.outputs.result }} --add-label "$LABEL_ADD" --remove-label "$LABEL_REMOVE"