Merge pull request #207 from CloudCannon/feat/astro-5 #62
Workflow file for this run
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: | |
push: | |
tags: | |
- v* | |
env: | |
HUGO_VERSION: 0.118.2 | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Swap to main | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
fetch-depth: 0 # Full fetch | |
- name: Get Token | |
id: get_workflow_token | |
uses: peter-murray/workflow-application-token-action@v2 | |
with: | |
application_id: ${{ secrets.CC_OSS_BOT_ID }} | |
application_private_key: ${{ secrets.CC_OSS_BOT_PEM }} | |
- name: Install hugo | |
uses: supplypike/setup-bin@v1 | |
with: | |
uri: "https://github.com/gohugoio/hugo/releases/download/v${{env.HUGO_VERSION}}/hugo_extended_${{env.HUGO_VERSION}}_linux-amd64.tar.gz" | |
name: "hugo" | |
version: ${{env.HUGO_VERSION}} | |
- name: Enable Corepack before setting up Node | |
run: corepack enable | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20.x | |
- name: Ubuntu AppArmor fix | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
# Ubuntu >= 23 has AppArmor enabled by default, which breaks Puppeteer. | |
# See https://github.com/puppeteer/puppeteer/issues/12818 "No usable sandbox!" | |
# this is taken from the solution used in Puppeteer's own CI: https://github.com/puppeteer/puppeteer/pull/13196 | |
# The alternative is to pin Ubuntu 22 or to use aa-exec to disable AppArmor for commands that need Puppeteer. | |
# This is also suggested by Chromium https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md | |
run: | | |
echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns | |
shell: bash | |
# TODO: Remove when possible (https://github.com/actions/setup-node/issues/515) | |
- name: Windows Node fix | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
$WhereNode = Get-Command node | Select-Object -ExpandProperty Definition | |
$NodeDirPath = Split-Path $WhereNode -Parent | |
cd $NodeDirPath | |
npm install [email protected] | |
- name: Use Ruby 2.7.x | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- name: Use Go 1.21.x | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "^1.21.1" | |
- name: Yarn stuff | |
run: | | |
yarn install --immutable | |
working-directory: ./javascript-modules | |
- name: Get Version | |
run: echo GIT_VERSION="$(git describe --tags | sed 's/^v\(.*\)$/\1/')" >> $GITHUB_ENV | |
- name: Verify Changelog | |
run: | | |
node ./.backstage/changelog.cjs | |
- name: Ensure main / tag parity | |
run: | | |
[[ $(git tag --points-at HEAD) = "v$GIT_VERSION" ]] && echo "Main is at v$GIT_VERSION" | |
- name: Update versions | |
run: | | |
node ./.backstage/version.js $GIT_VERSION | |
- name: Vendor dependencies | |
run: | | |
node ./.backstage/vendor.js | |
- run: yarn install | |
working-directory: ./javascript-modules | |
- name: Run tests | |
run: | | |
node ./.backstage/test.js | |
- name: Run integration tests | |
run : | | |
yarn run itest-slow | |
working-directory: ./javascript-modules/integration-tests | |
- name: Publish | |
run: | | |
node ./.backstage/publish.js $GIT_VERSION seriously | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} | |
- name: Build CHANGELOG | |
run: | | |
node ./.backstage/changelog.cjs write | |
if test -f "RELEASE.md"; then | |
echo HAS_RELEASE="true" >> $GITHUB_ENV | |
fi | |
- name: Update git | |
run: | | |
git config --global user.name "cloudcannon-oss[bot]" | |
git config --global user.email "115603236+cloudcannon-oss[bot]@users.noreply.github.com" | |
git add -A && git commit -m "build: releasing $GIT_VERSION" | |
git tag -a hugo/v$GIT_VERSION -m "build: releasing $GIT_VERSION" | |
git push && git push --tags | |
- name: Publish GitHub Release | |
uses: softprops/action-gh-release@v1 | |
if: env.HAS_RELEASE == 'true' | |
with: | |
body_path: RELEASE.md | |
env: | |
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }} |