pumpkin-api-ts/.github/workflows/main.yml
2026-08-03 17:47:32 -07:00

74 lines
1.9 KiB
YAML

name: Main
on: [push, pull_request, workflow_dispatch, workflow_call]
permissions:
contents: write
pull-requests: write
jobs:
main:
name: Build, test, and release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
- name: Install dependencies
run: npm install -D
- name: Build
run: npm pack
- name: Build example plugin to test
run: |
set -eux
cd example
npm install ../*.tgz
npm run build
- name: Set GITHUB_RELEASE_TAG & ARTIFACT_ID
run: |
set -eux
if [[ '${{ github.ref }}' = refs/tags/v* ]]; then
tag='${{ github.ref }}'
tag="${tag:10}"
artifactID="${tag:1}"
else
tag=CI
artifactID='${{ github.sha }}'
artifactID="${artifactID:0:8}"
fi
echo "GITHUB_RELEASE_TAG=$tag" >> $GITHUB_ENV
echo "ARTIFACT_ID=$artifactID" >> $GITHUB_ENV
- name: Rename artifacts
run: |
mv pumpkinmc-pumpkin-api-ts-*.tgz pumpkinmc-pumpkin-api-ts-${ARTIFACT_ID}.tgz
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: pumpkinmc-pumpkin-api-ts-*.tgz
- name: Upload artifacts to release
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
tag: ${{ env.GITHUB_RELEASE_TAG }}
artifacts: pumpkinmc-pumpkin-api-ts-*.tgz
allowUpdates: true
omitPrereleaseDuringUpdate: true
omitName: true
omitBody: true
omitDraftDuringUpdate: true
removeArtifacts: true