Skip to content

⬆️ Bump actions/checkout from 3 to 4 (#84) #593

⬆️ Bump actions/checkout from 3 to 4 (#84)

⬆️ Bump actions/checkout from 3 to 4 (#84) #593

Workflow file for this run

name: Build
on:
push:
pull_request:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
if: >
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: Use Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Lint and Test
run: deno task test
- name: Build
run: deno task build
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Verify No Unstaged Changes
run: |
if [[ "$(git status --porcelain)" != "" ]]; then
echo git status
git status
echo git diff
git diff
echo "::error::Unstaged changes detected."
exit 1
fi
compile:
runs-on: ubuntu-latest
if: >
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: Use Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Build
run: deno task compile
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: gh-describe-canary
path: ./dist/gh-describe-*
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
if: >
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: Use Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install on GitHub CLI Extensions
run: gh extensions install .
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Test Run on GitHub CLI Extensions with Deno
run: |
gh describe --runtime deno --version
gh describe --runtime deno
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Test Run on GitHub CLI Extensions with Node.js
run: |
gh describe --runtime node --version
gh describe --runtime node
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Test Run on Deno Run
shell: bash
run: |
deno run --allow-run https://raw.githubusercontent.com/proudust/gh-describe/"${GITHUB_SHA}"/main.ts --version
deno run --allow-run https://raw.githubusercontent.com/proudust/gh-describe/"${GITHUB_SHA}"/main.ts
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Test Run on GitHub Actions
id: ghd
uses: ./
- name: Check outputs
run: |
echo "describe : ${{ steps.ghd.outputs.describe }}"
echo "tag : ${{ steps.ghd.outputs.tag }}"
echo "distance : ${{ steps.ghd.outputs.distance }}"
echo "sha : ${{ steps.ghd.outputs.sha }}"
echo "short-sha : ${{ steps.ghd.outputs.short-sha }}"
release:
runs-on: ubuntu-latest
if: >
startsWith(github.ref, 'refs/tags/') ||
github.event_name == 'release'
needs:
- build
- compile
- test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore
uses: actions/download-artifact@v4
with:
name: gh-describe-canary
path: ./dist
- name: Run gh-describe
id: ghd
uses: ./
- name: Create Release and Upload Files
run: |
if gh release view "${GITHUB_RELEASE_TAG}" --json tagName >/dev/null && echo 'release found'; then
gh release upload --clobber "${GITHUB_RELEASE_TAG}" ./dist/gh-describe-*
else
gh release create -d --generate-notes "${GITHUB_RELEASE_TAG}" ./dist/gh-describe-*
fi
env:
GITHUB_RELEASE_TAG: ${{ steps.ghd.outputs.tag }}
GITHUB_TOKEN: ${{ github.token }}