Skip to content

.github/workflows/release.yml #105

.github/workflows/release.yml

.github/workflows/release.yml #105

Workflow file for this run

on:
push:
tags:
jobs:
release:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '22.20'
- name: Get Tag
id: tag
run: |
echo "::set-output name=value::${GITHUB_REF#refs/tags/}"
- name: Get Package
id: package
run: |
TAG="${{ steps.tag.outputs.value }}"
if [[ "$TAG" =~ @ ]]; then
PACKAGE="$(echo "$TAG" | sed -e 's#@[0-9].[0-9].[0-9]$##')"
else
PACKAGE="@shift-code/cli"
fi
echo "::set-output name=value::$PACKAGE"
- name: Get Version
id: version
run: |
TAG="${{ steps.tag.outputs.value }}"
VERSION="$(echo "$TAG" | sed -e 's#.*\([0-9].[0-9].[0-9]$\)#\1#')"
echo "::set-output name=value::$VERSION"
- name: Get Changes
id: changes
run: |
CHANGES=$(git log --graph --pretty=format:'%h - %s' "$(git describe --abbrev=0 --tags $(git describe --tags --abbrev=0)^)"..HEAD | cat)
echo "::set-output name=value::$CHANGES"
- name: Install
run: yarn install
- name: Build
run: yarn workspace ${{ steps.package.outputs.value }} run build
- name: Package
if: ${{ steps.package.outputs.value == '@shift-code/cli' }}
run: |
yarn workspace ${{ steps.package.outputs.value }} run pkg
for file in cli/pkg/cli-*; do
mv "$file" "$(echo "$file" | sed -e s#cli-#shift-code-#)"
done
- name: Release
if: ${{ steps.package.outputs.value == '@shift-code/cli' }}
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changes.outputs.value }}
files: cli/pkg/*
- name: Publish
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
git config user.email "git@tylerstewart.ca"
git config user.name "Tyler Stewart"
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
yarn workspace ${{ steps.package.outputs.value }} npm publish