Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: prerelease actions #83

Draft
wants to merge 1 commit into
base: old-main-pnh
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .github/workflows/onPushToMain.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# test
name: version, tag and github release

on:
push:
branches: [main]
branches:
- main
- prerelease/*
tags-ignore:
- "*"

jobs:
release:
# this job will throw if prerelease is true but it doesn't have a prerelease-looking package.json version
uses: salesforcecli/github-workflows/.github/workflows/githubRelease.yml@main
secrets: inherit

# most repos won't use this
# depends on previous job to avoid git collisions, not for any functionality reason
# docs:
# uses: salesforcecli/github-workflows/.github/workflows/publishTypedoc.yml@main
# secrets: inherit
# needs: release
with:
prerelease: ${{ github.ref_name != 'main' }}
19 changes: 16 additions & 3 deletions .github/workflows/onRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,33 @@ name: publish

on:
release:
types: [released]
# support manual release in case something goes wrong and needs to be repeated or tested
types: [published]
workflow_dispatch:
inputs:
tag:
description: tag that needs to publish
type: string
required: true

jobs:
# parses the package.json version and detects prerelease tag (ex: beta from 4.4.4-beta.0)
getDistTag:
outputs:
tag: ${{ steps.distTag.outputs.tag }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
- uses: salesforcecli/github-workflows/.github/actions/getPreReleaseTag@main
id: distTag

npm:
uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main
needs: [getDistTag]
with:
ctc: true
sign: true
tag: latest
tag: ${{ needs.getDistTag.outputs.tag || 'latest' }}
githubTag: ${{ github.event.release.tag_name || inputs.tag }}
secrets: inherit