diff --git a/.github/workflows/website-pr.yml b/.github/workflows/website-pr.yml new file mode 100644 index 00000000..e8b7fc5a --- /dev/null +++ b/.github/workflows/website-pr.yml @@ -0,0 +1,49 @@ +name: Open ohm-website PR +on: + workflow_run: + workflows: ["Release to npm"] + types: [completed] + workflow_dispatch: + inputs: + version: + description: 'map-styles version (empty = version in package.json)' + required: false + +jobs: + website-pr: + if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: staging + + - name: Get version + run: | + V="${{ inputs.version }}" + [ -z "$V" ] && V=$(node -p "require('./package.json').version") + echo "VERSION=$V" >> "$GITHUB_ENV" + + - uses: actions/checkout@v4 + with: + repository: OpenHistoricalMap/ohm-website + ref: staging + token: ${{ secrets.OHM_WEBSITE_TOKEN }} + path: ohm-website + + - name: Update map-styles + working-directory: ohm-website + run: | + for i in $(seq 1 30); do npm view "@openhistoricalmap/map-styles@${VERSION}" version && break; sleep 10; done + yarn add "@openhistoricalmap/map-styles@^${VERSION}" --ignore-scripts + + - uses: peter-evans/create-pull-request@v7 + with: + path: ohm-website + token: ${{ secrets.OHM_WEBSITE_TOKEN }} + base: staging + branch: map-styles-${{ env.VERSION }} + add-paths: package.json,yarn.lock + commit-message: Update map-styles to ${{ env.VERSION }} + title: Update map-styles to ${{ env.VERSION }} + body: After merge, update `OPENHISTORICALMAP_WEBSITE_GITSHA` in ohm-deploy.