Skip to content

Commit

Permalink
cicd: add git hash to snapshot release name
Browse files Browse the repository at this point in the history
  • Loading branch information
chmanie committed Jul 16, 2024
1 parent d84f63c commit 627a3ee
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,48 @@ jobs:
node-version: [20.11.0]
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 8.15.5

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Set relevant environment variables
run: |
if [[ ${{ github.event.inputs.includeNext }} == 'true' ]]; then
echo "COLONY_CONTRACTOR_INCLUDE_NEXT=true" >> $GITHUB_ENV
fi
- name: Create .npmrc (to be logged in for publishing)
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: pnpm run bootstrap

- run: pnpm run lint

- run: pnpm run build
env:
NODE_OPTIONS: --max-old-space-size=4096

- run: pnpm run test
env:
CI: true
NODE_OPTIONS: --max-old-space-size=4096

- name: Generate git hash of current HEAD
run: echo "VERSION_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Version snapshot
run: npx changeset version --snapshot snapshot && pnpm install --lockfile-only
run: npx changeset version --snapshot snapshot-{{ env.VERSION_HASH }} && pnpm install --lockfile-only

- name: Publish snapshot to npm
run: npx changeset publish --snapshot --tag snapshot --no-git-tag

0 comments on commit 627a3ee

Please sign in to comment.