Skip to content

Commit

Permalink
chore(release): call release-integration workflow from release
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf authored and wraithgar committed Jan 25, 2023
1 parent b74f834 commit 53bbc14
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 27 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/node-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ jobs:
echo "::endgroup::"
if [[ "${{ inputs.npmVersion }}" != "git" ]]; then
echo "::group::checking out npm@${{ inputs.npmVersion }}"
npmVersion="${{ inputs.npmVersion }}"
npmVersion="${npmVersion#v}"
echo "::group::checking out npm@${npmVersion}"
pushd "$npmDir" >/dev/null
npmVersion=$(curl -sSL https://registry.npmjs.org/npm |\
jq -r '.time | to_entries | map(select(.key | test("^${{ inputs.npmVersion }}"))) | sort_by(.value | split(".") | "\(.[0])Z" | fromdate) | .[-1].key')
npmGitHead=$(git show-ref --tags "v${npmVersion}" | cut -d' ' -f1)
git reset --hard "$npmGitHead"
taggedSha=$(git show-ref --tags "v${npmVersion}" | cut -d' ' -f1)
git reset --hard "$taggedSha"
publishedSha=$(curl -sSL https://registry.npmjs.org/npm | jq -r --arg ver "$npmVersion" '.versions[$ver].gitHead')
if [[ "$taggedSha" != "$publishedSha" ]]; then
echo "::warning ::git tag ($taggedSha) differs from published tag ($publishedSha)"
fi
popd >/dev/null
echo "::endgroup::"
fi
Expand Down
29 changes: 7 additions & 22 deletions .github/workflows/release-integration.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: release integration

on:
release:
types:
- published
workflow_call:
inputs:
npmVersion:
description: npm version to test
type: string
required: true
workflow_dispatch:
inputs:
npmVersion:
Expand All @@ -12,21 +15,6 @@ on:
required: true

jobs:
npm-version:
env:
npmVersion: ${{ inputs.npmVersion || github.ref_name }}
name: determine npm version
if: ${{ inputs.npmVersion || startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
outputs:
npmVersion: ${{ steps.version.outputs.npmVersion }}
steps:
- name: clean npm version
id: version
run: |
npmVersion="${{ env.npmVersion }}"
npmVersion="${npmVersion/#v}"
echo "npmVersion=${npmVersion}" >> $GITHUB_OUTPUT
node-integration:
name: nodejs@${{ matrix.nodeVersion }} integration
strategy:
Expand All @@ -36,10 +24,7 @@ jobs:
- 18
- 19
- nightly
needs:
- npm-version
uses: ./.github/workflows/node-integration.yml
with:
nodeVersion: ${{ matrix.nodeVersion }}
npmVersion: ${{ needs.npm-version.outputs.npmVersion }}

npmVersion: ${{ inputs.npmVersion }}
3 changes: 3 additions & 0 deletions scripts/template-oss/_job-release-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
uses: ./.github/workflows/release-integration.yml
with:
npmVersion: $\{{ fromJSON(needs.release.outputs.release).version }}

0 comments on commit 53bbc14

Please sign in to comment.