mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-22 22:56:07 +00:00
70 lines
1.9 KiB
YAML
70 lines
1.9 KiB
YAML
---
|
|
name: action
|
|
|
|
on: [push, workflow_dispatch]
|
|
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
jobs:
|
|
version:
|
|
name: Version with commit unique id
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Version it!
|
|
run: |
|
|
# We expect a string such as const setupBeamVersion = 'undefined' in the code
|
|
SHA=$(git rev-parse --short HEAD)
|
|
sed -i'.bak' \
|
|
-e "s/const setupBeamVersion = '.*'/const setupBeamVersion = '${SHA}'/g" \
|
|
src/setup-beam.js
|
|
npm run build-dist
|
|
git config user.name "GitHub Actions"
|
|
git config user.email "actions@user.noreply.github.com"
|
|
git add src/setup-beam.js
|
|
git add dist/index.js
|
|
git commit -m "Automation: update setup-beam version output to ${SHA}"
|
|
git push origin main
|
|
check_integrity:
|
|
name: Expected local npm actions
|
|
runs-on: ubuntu-latest
|
|
if: github.ref != 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
- run: npm run build-dist
|
|
- name: Check if build left artifacts
|
|
run: git diff --exit-code --ignore-space-at-eol
|
|
|
|
unit_tests_ubuntu:
|
|
name: Unit tests (Ubuntu)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
- run: npm ci
|
|
- run: npm test
|
|
- name: .tool-versions test
|
|
id: setup-beam
|
|
uses: ./
|
|
with:
|
|
version-file: test/.tool-versions
|
|
version-type: strict
|
|
|
|
unit_tests_windows:
|
|
name: Unit tests (Windows)
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
- run: npm install --production
|
|
- run: npm test
|