diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b785b40..57833bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,65 +16,64 @@ name: Build Package on: - push: - branches: - - "**" - tags-ignore: - - "*.*" + push: + branches: + - '**' + tags-ignore: + - '*.*' jobs: - build: - name: Build and test - runs-on: ubuntu-latest - outputs: - version: ${{ steps.npm.outputs.version }} - prerelease: ${{ steps.npm.outputs.prerelease }} - is_prerelease: ${{ steps.npm.outputs.is_prerelease }} - deploy: ${{ steps.npm.outputs.deploy }} + build: + name: Build and test + runs-on: ubuntu-latest + outputs: + version: ${{ steps.npm.outputs.version }} + prerelease: ${{ steps.npm.outputs.prerelease }} + is_prerelease: ${{ steps.npm.outputs.is_prerelease }} + deploy: ${{ steps.npm.outputs.deploy }} - steps: - - name: Install, build and test - uses: tfso/action-helpers/npm-build@v1 - id: npm - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_GLOBAL_TOKEN: ${{ secrets.TFSO_REPO_READ }} - NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }} - TRUNCATE_PRERELEASE: true - NODE_VERSION: 18 + steps: + - name: Install, build and test + uses: tfso/action-helpers/npm-build@v1 + id: npm + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_GLOBAL_TOKEN: ${{ secrets.TFSO_REPO_READ }} + NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }} + TRUNCATE_PRERELEASE: true + NODE_VERSION: 18 - - name: upload artifact (from content in ./dist folder) - uses: actions/upload-artifact@v3 - with: - name: artifact - path: ./dist + - name: upload artifact (from content in ./dist folder) + uses: actions/upload-artifact@v3 + with: + name: artifact + path: ./dist - publish: - name: publish prerelease - if: ${{ needs.build.outputs.deploy == 'true' }} - needs: build - runs-on: ubuntu-latest - permissions: - contents: read - packages: write + publish: + name: publish prerelease + if: ${{ needs.build.outputs.deploy == 'true' }} + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write - steps: - - name: download artifact - uses: actions/download-artifact@v3 - with: - name: artifact + steps: + - name: download artifact + uses: actions/download-artifact@v3 + with: + name: artifact - - name: setup - uses: actions/setup-node@v4 - with: - node-version: 18 - registry-url: https://npm.pkg.github.com/ - scope: "@tfso" - - - name: Publish prerelease to Npm - run: | - npm version prerelease --preid=${{github.ref_name}}-${{github.run_number}} --no-git-tag-version - npm publish --verbose --tag dev - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: setup + uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://npm.pkg.github.com/ + scope: '@tfso' + - name: Publish prerelease to Npm + run: | + npm version prerelease --preid=${{github.ref_name}}-${{github.run_number}} --no-git-tag-version + npm publish --verbose --tag dev --no-tag + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f34db17..dc04fdb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,73 +16,73 @@ name: Release Package on: - release: - types: [published] + release: + types: [published] jobs: - build: - name: build release - runs-on: ubuntu-latest - if: github.event.release.draft == false && github.event.release.prerelease == false - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + build: + name: build release + runs-on: ubuntu-latest + if: github.event.release.draft == false && github.event.release.prerelease == false + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: npm access token - run: | - npm config set @tfso:registry=https://npm.pkg.github.com --userconfig .npmrc - npm config set //npm.pkg.github.com/:_authToken=${NPM_TOKEN} --userconfig .npmrc - env: - NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }} + - name: npm access token + run: | + npm config set @tfso:registry=https://npm.pkg.github.com --userconfig .npmrc + npm config set //npm.pkg.github.com/:_authToken=${NPM_TOKEN} --userconfig .npmrc + env: + NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }} - - name: Update package.json and CHANGELOG.md - run: | - git config --global user.name '${{github.actor}}' - git config --global user.email '${{github.actor}}@users.noreply.github.com' - npm version ${{github.event.release.tag_name}} --no-git-tag-version - npx auto-changelog -p && git add CHANGELOG.md - git add package.json - git commit -m "Update package.json version to ${{github.event.release.tag_name}} " - git push origin HEAD:${{github.event.release.target_commitish}} - - uses: actions/setup-node@v4 - with: - node-version: 18 + - name: Update package.json and CHANGELOG.md + run: | + git config --global user.name '${{github.actor}}' + git config --global user.email '${{github.actor}}@users.noreply.github.com' + npm version ${{github.event.release.tag_name}} --no-git-tag-version + npx auto-changelog -p && git add CHANGELOG.md + git add package.json + git commit -m "Update package.json version to ${{github.event.release.tag_name}} " + git push origin HEAD:${{github.event.release.target_commitish}} + - uses: actions/setup-node@v4 + with: + node-version: 18 - - name: install project - run: npm ci + - name: install project + run: npm ci - - name: build project - run: npm run build + - name: build project + run: npm run build - - name: upload artifact (from content in ./dist folder) - uses: actions/upload-artifact@v3 - with: - name: artifact - path: ./dist + - name: upload artifact (from content in ./dist folder) + uses: actions/upload-artifact@v3 + with: + name: artifact + path: ./dist - publish: - name: publish release - needs: build - runs-on: ubuntu-latest - permissions: - contents: read - packages: write + publish: + name: publish release + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write - steps: - - name: download artifact - uses: actions/download-artifact@v3 - with: - name: artifact + steps: + - name: download artifact + uses: actions/download-artifact@v3 + with: + name: artifact - - name: setup - uses: actions/setup-node@v4 - with: - node-version: 18 - registry-url: https://npm.pkg.github.com/ - scope: "@tfso" + - name: setup + uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://npm.pkg.github.com/ + scope: '@tfso' - - name: Publish release to Npm - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file + - name: Publish release to Npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}