Skip to content

Merge pull request #204 from CloudCannon/chore/more-deps #59

Merge pull request #204 from CloudCannon/chore/more-deps

Merge pull request #204 from CloudCannon/chore/more-deps #59

Workflow file for this run

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
# 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 }}