diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dff0944..0e582d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,35 +1,50 @@ -name: release + +name: Release Build on: release: types: [created] +permissions: + contents: write + jobs: build: - environment: automated-release runs-on: ubuntu-22.04 + environment: automated-release + env: - GH_TOKEN: ${{secrets.GH_TOKEN}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + steps: - - uses: actions/checkout@v2 - - name: Add config details - run: | - git config --global user.name ${{secrets.NAME}} - git config --global user.email ${{secrets.EMAIL}} - - name: Move release to draft - run: gh release edit $TAG_NAME --draft=true - env: - TAG_NAME: ${{ github.event.release.tag_name }} - - name: Run npm install, build and test - run: | - npm i - npm run build - npm run test - npm run lint - - run: zip -r release.zip lib *.md LICENSE SECURITY.md package.json package-lock.json -x 'lib/test/*' 'lib/src/*' - - name: Upload production artifacts - run: | - gh release upload $TAG_NAME "release.zip#release" - gh release edit $TAG_NAME --draft=false - env: - TAG_NAME: ${{ github.event.release.tag_name }} \ No newline at end of file + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Move release to draft + run: gh release edit "$TAG_NAME" --draft=true + env: + TAG_NAME: ${{ github.event.release.tag_name }} + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Test + run: npm run test + + - name: Lint + run: npm run lint + + - name: Create release archive + run: | + zip -r release.zip lib *.md LICENSE SECURITY.md package.json package-lock.json \ + -x 'lib/test/*' 'lib/src/*' + + - name: Upload production artifacts + run: | + gh release upload $TAG_NAME "release.zip#release" + gh release edit $TAG_NAME --draft=false + env: + TAG_NAME: ${{ github.event.release.tag_name }} \ No newline at end of file