Fix flat json front matter #6
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: | |
CARGO_TERM_COLOR: always | |
jobs: | |
publish-crate: | |
name: Publish Crate | |
runs-on: ubuntu-20.04 | |
needs: publish-github-release | |
steps: | |
- name: Clone | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
~/.rustup | |
target | |
key: ${{ runner.os }}-stable-min165 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
default: true | |
components: rustfmt, clippy | |
- name: Get Version | |
run: echo GIT_VERSION="$(git describe --tags | sed 's/^v\(.*\)$/\1/')" >> $GITHUB_ENV | |
- name: Prepare Git | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Github Actions" | |
git checkout -b main | |
# Use throw-away branch so we don't push the changes to origin | |
git checkout -b deploy_branch | |
- name: Prepare Crates | |
run: | | |
# Update cargo version, | |
node ./.backstage/version.cjs | |
git add ./Cargo.toml | |
# Commit changes so cargo doesn't complain about dirty repo | |
git commit -m "Deploy changes." | |
- name: Publish | |
run: cargo publish --allow-dirty | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
publish-github-release: | |
name: GitHub Release | |
runs-on: ubuntu-20.04 | |
needs: test | |
steps: | |
- 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: Clone | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.get_workflow_token.outputs.token }} | |
- name: Swap to main | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 0 # Full fetch | |
token: ${{ steps.get_workflow_token.outputs.token }} | |
- name: Get Version | |
run: echo GIT_VERSION="$(git describe --tags | sed 's/^v\(.*\)$/\1/')" >> $GITHUB_ENV | |
- name: Get Tag | |
run: echo GIT_TAG="$(node ./.backstage/get_tag.cjs)" >> $GITHUB_ENV | |
- name: Build CHANGELOG | |
if: env.GIT_TAG == 'latest' | |
run: | | |
node ./.backstage/changelog.cjs write | |
echo CHANGELOG=\"$(base64 -w 0 -i CHANGELOG.md)\" >> $GITHUB_ENV | |
echo SHA=\"$( git rev-parse main:CHANGELOG.md )\" >> $GITHUB_ENV | |
- name: Build CHANGELOG | |
if: env.GIT_TAG != 'latest' | |
run: | | |
echo "## Prerelease" > RELEASE.md | |
node ./.backstage/changelog.cjs write || true | |
- name: Commit new CHANGELOG | |
uses: octokit/[email protected] | |
if: env.GIT_TAG == 'latest' | |
id: push_changes | |
with: | |
route: PUT /repos/{owner}/{repo}/contents/CHANGELOG.md | |
owner: cloudcannon | |
repo: matterhorn | |
branch: main | |
message: Changelog for ${{ env.GIT_VERSION }} | |
sha: ${{ env.SHA }} | |
content: ${{ env.CHANGELOG }} | |
env: | |
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
repository: cloudcannon/matterhorn | |
prerelease: false | |
body_path: RELEASE.md | |
env: | |
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }} | |
test: | |
name: Test | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
~/.rustup | |
target | |
key: ${{ runner.os }}-${{ matrix.rust }}-min165 | |
- name: Install Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Test Lib | |
run: cargo test |