Skip to content

Disable tag step for testing #3

Disable tag step for testing

Disable tag step for testing #3

Workflow file for this run

name: Publish
on:
push:
branches:
- MattIPv4/image-optimization
jobs:
version:
runs-on: ubuntu-latest
outputs:
description: "New version identifier (if changed)"
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
sparse-checkout: package.json
- name: Check version
id: version
run: |
set -e -o pipefail
BEFORE_VERSION=$(git show "${{ github.event.before }}:package.json" | jq -r .version)
AFTER_VERSION=$(git show "${{ github.event.after }}:package.json" | jq -r .version)
if [ "$BEFORE_VERSION" != "$AFTER_VERSION" ]; then
echo "Version changed from $BEFORE_VERSION to $AFTER_VERSION"
echo "version=$AFTER_VERSION" >> "$GITHUB_OUTPUT"
fi
- name: Tag version
if: ${{ steps.version.outputs.version }}
run: |
set -e -o pipefail
git tag "${{ steps.version.outputs.version }}" "${{ github.event.after }}"
git push origin "${{ steps.version.outputs.version }}"
# tag:
# runs-on: ubuntu-latest
# permissions:
# contents: write
# needs: version
# if: ${{ needs.version.outputs.version }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# sparse-checkout: package.json
# - name: Tag version
# run: |
# set -e -o pipefail
# git tag "${{ needs.version.outputs.version }}" "${{ github.event.after }}"
# git push origin "${{ needs.version.outputs.version }}"
publish:
runs-on: ubuntu-latest
permissions:
packages: write
needs: version
if: ${{ needs.version.outputs.version }}
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
registry-url: https://npm.pkg.github.com
scope: '@alveusgg'
- name: Cache optimized assets
uses: actions/cache@v4
with:
path: build/assets
key: optimized-assets-${{ hashFiles('src/assets/**') }}
restore-keys: |
optimized-assets-
- name: Install dependencies
run: npm ci
- name: Publish package
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}