Release #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'premajor/prerelease/prepatch/major/minor/patch' | |
required: true | |
default: 'patch' | |
tag: | |
description: 'latest/rc/beta' | |
required: true | |
default: 'latest' | |
preid: | |
description: 'rc/beta' | |
required: false | |
default: '' | |
branch: | |
description: 'master/next/beta' | |
required: true | |
default: 'master' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm install | |
- run: npm ci | |
- run: npm run lint | |
- run: npm run build | |
version: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Temporarily disable "include administrators" branch protection | |
uses: benjefferies/branch-protection-bot@master | |
if: always() | |
with: | |
access_token: ${{ secrets.BUILD_SVC_PAT }} | |
branch: ${{ github.event.repository.default_branch }} | |
- name: Push the change | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
token: ${{ secrets.BUILD_SVC_PAT }} | |
- run: git config --global user.name '[GitHub Bot]' | |
- run: git config --global user.email '<>' | |
- run: npm version ${{ github.event.inputs.version }} --preid=${{ github.event.inputs.preid }} -m "[${{ github.event.inputs.tag }}] %s" | |
- run: npm update homebridge-eufy-security | |
- run: git push --force | |
- run: git push origin --tags --force | |
- name: "Restore 'include administrators' default branch protection" | |
uses: benjefferies/branch-protection-bot@master | |
if: always() # Force to always run this step to ensure "include administrators" is always turned back on | |
with: | |
access_token: ${{ secrets.BUILD_SVC_PAT }} | |
branch: ${{ github.event.repository.default_branch }} | |
enforce_admins: ${{ steps.disable_include_admins.outputs.initial_status }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: version | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
node-version: 18 | |
ref: ${{ github.event.inputs.branch }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm ci | |
- run: npm publish --access public --tag ${{ github.event.inputs.tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.npm_token}} |