Skip to content

Commit

Permalink
ci(release): update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
itschip committed Nov 18, 2023
1 parent 1bd611e commit 96205e1
Showing 1 changed file with 21 additions and 62 deletions.
83 changes: 21 additions & 62 deletions .github/workflows/tagged-releases.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: Tagged Release Publisher

permissions:
id-token: write
contents: write
actions: write
deployments: write
pull-requests: read

on:
workflow_dispatch:

Expand All @@ -17,7 +24,7 @@ jobs:
- name: Get tag
uses: project-error/[email protected]
with:
environment: "dev"
environment: "prod"
prerelease: true
id: get_tag
env:
Expand Down Expand Up @@ -82,72 +89,24 @@ jobs:
cd ./temp && zip -r ../npwd.zip ./npwd
- name: Create Release
uses: "marvinpinto/[email protected].1"
uses: "project-error/release-action@v2.1"
id: auto_release
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: NPWD Release ${{ steps.get_tag.outputs.release_tag }}
prerelease: false
environment: "prod"
title: NPWD ${{ steps.get_tag.outputs.release_tag }}
prerelease: true
automatic_release_tag: ${{ steps.get_tag.outputs.release_tag }}
files: npwd.zip

env:
CI: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-npwd-packages:
name: Build NPWD packages
runs-on: ubuntu-latest
needs: create-tagged-release

steps:
- name: Get tag
run: echo ::set-output name=VERSION_TAG::${GITHUB_REF/refs\/tags\//}
id: get_tag
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 7.29.1
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile

# Build all packages
- name: Build @npwd/types
- name: Upload artifacts
run: |
pnpm generate:typings
cd ./packages/npwd-types
git config user.email "[email protected]"
git config user.name "itschip"
pnpm version --new-version ${{ steps.get_tag.outputs.VERSION_TAG }}
- name: Release @npwd/types
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: './packages/npwd-types/package.json'
access: 'public'

- name: Build @npwd/hooks
run: |
cd ./packages/npwd-hooks
pnpm build
git config user.email "[email protected]"
git config user.name "itschip"
pnpm version --new-version ${{ steps.get_tag.outputs.VERSION_TAG }}
- name: Release @npwd/hooks
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: './packages/npwd-hooks/package.json'
access: 'public'
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/project-error/npwd/releases/${{ steps.auto_release.outputs.release_id }}/assets?name=npwd.zip" \
--data-binary "@npwd.zip"

0 comments on commit 96205e1

Please sign in to comment.