Skip to content

Commit

Permalink
chore: npm reorder tag detection
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Aug 22, 2024
1 parent 2023574 commit d222f70
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,30 @@ jobs:
env:
TAG_PREFIX: v

- name: Set suffix
uses: actions/github-script@v6
id: suffix
with:
result-encoding: string
script: |
const fullTag = "${{ inputs.tag }}" || context.payload.release.tag_name;
const firstMinusIndex = fullTag.indexOf('-');
if (firstMinusIndex !== -1) {
return fullTag.substring(firstMinusIndex);
} else {
return '';
}
- name: Set NPM release tag
uses: actions/github-script@v6
id: tag
with:
result-encoding: string
script: |
const tag = "${{ inputs.tag }}" || context.payload.release.tag_name;
const [, major, minor] = tag.match(/^v([0-9]+)\.([0-9]+)/);
return (tag.includes('-') ? `${major}.${minor}-${{steps.suffix.outputs.result}}` : 'latest');
- name: Configure AWS credentials and bucket region
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down Expand Up @@ -79,30 +103,6 @@ jobs:
SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32
if: ${{ steps.cache.outputs.cache-hit != 'true' }}

- name: Set suffix
uses: actions/github-script@v6
id: suffix
with:
result-encoding: string
script: |
const fullTag = "${{ inputs.tag }}" || context.payload.release.tag_name;
const firstMinusIndex = fullTag.indexOf('-');
if (firstMinusIndex !== -1) {
return fullTag.substring(firstMinusIndex);
} else {
return '';
}
- name: Set NPM release tag
uses: actions/github-script@v6
id: tag
with:
result-encoding: string
script: |
const tag = "${{ inputs.tag }}" || context.payload.release.tag_name;
const [, major, minor] = tag.match(/^v([0-9]+)\.([0-9]+)/);
return (tag.includes('-') ? `${major}.${minor}-${{steps.suffix.outputs.result}}` : 'latest');
- name: Configure NPM auth token
run: yarn config set npmAuthToken ${{ secrets.NPM_TOKEN }}

Expand Down

0 comments on commit d222f70

Please sign in to comment.