Skip to content

Merge branch 'main' of https://github.com/helsingborg-stad/OpenStreetMap #83

Merge branch 'main' of https://github.com/helsingborg-stad/OpenStreetMap

Merge branch 'main' of https://github.com/helsingborg-stad/OpenStreetMap #83

Workflow file for this run

name: Bump version and publish NPM package
on:
push:
branches: [main]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create Release and bump version files
uses: helsingborg-stad/release-wp-plugin-action@1.0.2
with:
node-version: 20.6.0
publish:
needs: ['release']
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest release version
id: get-version
run: |
echo "LATEST_RELEASE=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')" >> $GITHUB_ENV
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: "https://npm.pkg.github.com"
- name: Inject access token in .npmrc
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc
- name: Update version in package.json
run: |
jq --arg version "${{ env.LATEST_RELEASE }}" '.version = $version' package.json > temp.json && mv temp.json package.json
- name: Install dependencies
run: npm ci --no-progress --no-audit --include=dev
- name: Build TypeScript files
run: npm run build
- name: Publish to GitHub Packages
run: npm publish --registry=https://npm.pkg.github.com
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup .npmrc
run: rm ~/.npmrc