Publish pre-release #87
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish pre-release | |
on: | |
schedule: | |
- cron: '15 4 * * 2' # every tuesday at 4:15AM UTC | |
workflow_dispatch: | |
jobs: | |
check: | |
name: Check for pre release changes | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'certinia' | |
permissions: | |
contents: write | |
outputs: | |
exitstatus: ${{ steps.earlyexit.outputs.exitstatus }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: earlyexit | |
name: Should publish pre release | |
run: | | |
echo "Checking if Log Analyzer Pre Release can be published" | |
headSHA=$(git rev-parse HEAD) | |
if [ $(git tag -l pre) ]; then | |
preSHA=$(git rev-parse --verify -q "pre") | |
fi | |
stableTag=$(git tag '*.*.*' --list --sort=-version:refname | head -n1 ) | |
stableSHA=$(git rev-parse $stableTag) | |
echo "HEAD | |
$(git show $headSHA -s --format="commit: %h Date: %ad") | |
Pre release | |
$(git show $preSHA -s --format="commit: %h Date: %ad") | |
Stable release ($stableTag) | |
$(git show $stableSHA -s --format="commit: %h Date: %ad")" | |
if [ "$headSHA" = "$preSHA" ] || [ "$headSHA" = "$stableSHA" ]; then | |
echo " | |
No pre-release needed, No changes since last pre-release or stable version. Exiting." | |
echo "exitstatus=exit" >> "$GITHUB_OUTPUT" | |
exit 0 | |
fi | |
echo "exitstatus=continue" >> "$GITHUB_OUTPUT" | |
publish: | |
name: Publish pre-release | |
needs: check | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'certinia' && needs.check.outputs.exitstatus == 'continue' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Install vsce + ovsx | |
run: | | |
pnpm add --global @vscode/vsce | |
pnpm add --global ovsx | |
- name: Dependencies | |
run: | | |
HUSKY=0 pnpm install | |
- name: update pre-release version | |
run: | | |
echo "Updating pre-release version" | |
pnpm run bump-prerelease; | |
- name: Package the extension | |
run: | | |
cd lana | |
vsce package --pre-release --no-dependencies | |
- name: Publish to VS Code Marketplace + Open VSX Registry | |
run: | | |
cd lana | |
echo "Verify vsce token has not expired" | |
vsce verify-pat -p ${{ secrets.VSCE_TOKEN }} | |
echo " | |
Verify ovsx token has not expired" | |
ovsx verify-pat -p ${{ secrets.OVSX_TOKEN }} | |
versionNum=$(cat package.json | jq -r '.version') | |
pkgPath=lana-${versionNum}.vsix | |
echo "Publish to vsce | |
vsix name: $pkgPath" | |
vsce publish --packagePath ${pkgPath} --no-dependencies --pre-release --skip-duplicate -p ${{ secrets.VSCE_TOKEN }} | |
echo " | |
Publish to ovsx" | |
ovsx publish ${pkgPath} --no-dependencies --pre-release --skip-duplicate -p ${{ secrets.OVSX_TOKEN }} | |
- name: Update pre-release tag | |
run: | | |
echo "Updating pre release tag" | |
git tag -f pre | |
git push -f origin pre |