Skip to content

Merge pull request #782 from shogo82148/dependabot/npm_and_yarn/types… #1840

Merge pull request #782 from shogo82148/dependabot/npm_and_yarn/types…

Merge pull request #782 from shogo82148/dependabot/npm_and_yarn/types… #1840

Workflow file for this run

name: "test"
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- "releases/*"
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- name: disable auto CRLF
run: git config --global core.autoCRLF false
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
check-permission:
name: check permission
runs-on: ubuntu-latest
outputs:
permission: ${{ steps.check.outputs.permission }}
steps:
- id: check
uses: shogo82148/actions-check-permissions@v1
- name: the result
run: echo ${{ steps.check.outputs.permission }}
integrated:
name: integrated test
runs-on: ubuntu-latest
needs:
- check-permission
if: needs.check-permission.outputs.permission == 'write'
outputs:
id: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run pack
- name: Create Release
id: create_release
uses: shogo82148/actions-create-release@v1
with:
tag_name: test-${{ github.run_id }}
release_name: Test for ${{ github.run_id }}
prerelease: true
body: |
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: upload
uses: ./
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: lib/*.js
- name: overwrite
uses: ./
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: lib/*.js
overwrite: true
cleanup:
if: always()
name: cleanup
runs-on: ubuntu-latest
needs:
- integrated
steps:
- name: cleanup
run: |
curl -XDELETE -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $GITHUB_TOKEN" \
"$GITHUB_API_URL/repos/${{ github.repository }}/releases/${{ needs.integrated.outputs.id }}"
sleep 5 # it takes a moment to delete the release
curl -XDELETE -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $GITHUB_TOKEN" \
"$GITHUB_API_URL/repos/${{ github.repository }}/git/refs/tags/test-${{ github.run_id }}"
if: always()
env:
GITHUB_TOKEN: ${{ github.token }}