publish #34
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 | |
on: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
publish-prerelease: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup - git | |
run: | | |
git --version | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git status | |
- name: Setup - just | |
uses: taiki-e/install-action@just | |
- name: Try bump kanata | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
status=$(just bump_kanata > /dev/null 2>&1; echo $?) | |
if [ $status -eq 0 ]; then | |
git push | |
elif [ $status -eq 123 ]; then | |
# Status 123 means that the version of kanata is already | |
# most recent (at least according to CHANGELOG.md). | |
exit 1 | |
else | |
echo "Failed with $status" | |
exit 1 | |
fi | |
- name: Setup - cargo cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Setup - wasm-pack and wasm32-unknown-unknown target | |
run: | | |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
rustup target add wasm32-unknown-unknown | |
- name: Setup - Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '21' | |
cache: 'yarn' | |
- name: Setup - install yarn | |
run: yarn | |
- name: Extract version from package.json | |
uses: sergeysova/jq-action@v2 | |
id: version | |
with: | |
cmd: 'jq .version package.json --raw-output --exit-status' | |
- name: Increment semver patch number | |
id: new_version | |
run: | | |
echo "value=$(curl https://gist.githubusercontent.com/rszyma/c539a0dbe37d7de9f0c04c628b7a341a/raw/684177cd54d51c3bd8786e0d2b380e67f495fc1f/increment_version.sh -sSf | bash -s -- -p ${{ steps.version.outputs.value }})" >> $GITHUB_OUTPUT | |
- name: Setup - vsce | |
run: yarn global add vsce | |
- name: Verify that VSCE_PAT is correct | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_ACCESS_TOKEN }} | |
run: vsce verify-pat rszyma | |
- name: Build and publish | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_ACCESS_TOKEN }} | |
run: | | |
make CARGO_FLAGS=--release package | |
just release ${{ steps.new_version.outputs.value }} |