Init #8
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: Test Setup Regal | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
name: Test Setup Regal | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
version: ["<0.9", "0.10.0", "latest"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Regal | |
uses: ./ | |
with: | |
version: ${{ matrix.version }} | |
- name: Get expected version | |
run: | | |
if [ "${{ matrix.version }}" = "<0.9" ]; then | |
export EXPECTED_VERSION=v0.8.0 | |
elif [ "${{ matrix.version }}" = "0.10.0" ]; then | |
export EXPECTED_VERSION=v0.10.0 | |
else | |
# get the latest version info from the github api | |
export EXPECTED_VERSION=$(curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/StyraInc/regal/releases/latest | jq -r .name ) | |
fi | |
echo "Expected version for ${{ matrix.version }}: $EXPECTED_VERSION" | |
echo "EXPECTED_VERSION=$EXPECTED_VERSION" >> $GITHUB_ENV | |
- name: Capture version installed | |
run: | | |
echo "VERSION_INSTALLED=$( regal version | head -1 | echo "v$(awk '{ print $2}')" )" >> $GITHUB_ENV | |
- name: Verify | |
shell: bash | |
run: | | |
if [ "$EXPECTED_VERSION" != "$VERSION_INSTALLED" ]; then | |
echo "Unexpected version, expected $EXPECTED_VERSION, got: $VERSION_INSTALLED" | |
exit 1; | |
fi | |
exit 0; | |
verify-dist: | |
name: Verify Dist Dir State | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- run: npm install | |
- name: Rebuild dist (npm run prepare) | |
run: npm run prepare | |
- name: Verify no dist changes | |
run: | | |
if [ -n "$(git status dist --porcelain)" ]; then | |
# Uncommitted changes | |
git status dist --porcelain | |
echo "::error::Uncommitted changes after npm run prepare. Run 'npm run prepare' and commit any changes to ./dist." | |
exit 1 | |
fi |