Release #84
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version" | |
required: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
CI_USER: ${{ secrets.CI_USER}} | |
CI_EMAIL: ${{ secrets.CI_EMAIL }} | |
VERSION: ${{ github.event.inputs.version }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# pulls all commits (needed for lerna / semantic release to correctly version) | |
fetch-depth: "0" | |
# pulls all tags (needed for lerna / semantic release to correctly version) | |
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- run: git config --global user.email "$CI_EMAIL" | |
- run: git config --global user.name "$CI_USER" | |
- name: Setup npm | |
uses: actions/setup-node@v3 | |
with: | |
cache: "npm" | |
node-version: "16.x" | |
registry-url: "https://registry.npmjs.org" | |
- run: npm ci | |
- name: Build project | |
run: npm run build | |
- name: NPM version | |
run: npm version $VERSION -no-git-tag-version | |
- name: Generate Changelog | |
run: npm run changelog | |
- name: NPM who am i!? | |
run: npm whoami | |
- name: NPM publish | |
run: npm run custom:publish -- $VERSION | |
- name: Push Version Commit | |
run: git push --follow-tags | |
- name: Extract Changelog | |
uses: yashanand1910/standard-release-notes@v1.2.1 | |
id: get_release_notes | |
with: | |
version: ${{ env.VERSION }} # Required | |
- name: Create Release | |
id: create_release | |
uses: "actions/github-script@v6" | |
with: | |
github-token: "${{ env.GITHUB_TOKEN }}" | |
script: | | |
try { | |
await github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: '${{ env.VERSION }}', | |
name: 'Release ${{ env.VERSION }}', | |
body: `${{ steps.get_release_notes.outputs.release_notes }}`, | |
draft: false, | |
prerelease: false, | |
generate_release_notes: true, | |
}); | |
} catch (error) { | |
core.setFailed(error.message); | |
} | |
- name: Build docs | |
run: npm run docs:build | |
- name: Azure login | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_TOKEN }} | |
- name: Delete old docs | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az storage remove -c '$web' --exclude-path "demos" --recursive --account-name prsv | |
- name: Upload to Azure blob storage | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az storage blob upload-batch --account-name prsv -d '$web' -s ./docs/.vuepress/dist | |
- name: Purge CDN | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az cdn endpoint purge -n ${{ secrets.AZURE_CDN_ENDPOINT }} --profile-name ${{ secrets.AZURE_CDN_PROFILE_NAME }} --content-paths "/*" --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} --no-wait | |
- name: Azure logout | |
run: | | |
az logout |