mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-06-29 16:41:39 +00:00
chore: fix ci.yml
This commit is contained in:
@@ -10,102 +10,103 @@ permissions:
|
||||
name: release-please
|
||||
|
||||
jobs:
|
||||
- release-please:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_created: ${{ steps.release.outputs.release_created }}
|
||||
version: "${{steps.release.outputs.major}}.${{steps.release.outputs.minor}}.${{steps.release.outputs.patch}}"
|
||||
steps:
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_created: ${{ steps.release.outputs.release_created }}
|
||||
version: "${{steps.release.outputs.major}}.${{steps.release.outputs.minor}}.${{steps.release.outputs.patch}}"
|
||||
steps:
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- uses: google-github-actions/release-please-action@v3
|
||||
id: release
|
||||
with:
|
||||
release-type: node
|
||||
package-name: release-please-action
|
||||
default-branch: dev
|
||||
token: ${{secrets.GH_TOKEN}}
|
||||
|
||||
# Checkout repos
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: koenkk/zigbee2mqtt
|
||||
path: ./z2m
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: koenkk/zigbee2mqtt
|
||||
path: ./z2m-master
|
||||
ref: master
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: koenkk/zigbee2mqtt
|
||||
path: ./z2m-changelog
|
||||
ref: release-please--branches--dev--components--release-please-action
|
||||
|
||||
- name: Update latest-dev tag
|
||||
run: |
|
||||
cd z2m
|
||||
git push --delete origin latest-dev
|
||||
git tag latest-dev
|
||||
git push origin latest-dev
|
||||
- name: Update latest-dev release changelog
|
||||
run: |
|
||||
PR=$(echo '${{ steps.release.outputs.pr }}' | jq -r '.number')
|
||||
MASTER_Z2M_VERSION=$(cat z2m-master/package.json | jq -r '.version')
|
||||
MASTER_ZHC_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman-converters"')
|
||||
MASTER_ZH_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman"')
|
||||
cp z2m-changelog/CHANGELOG.md z2m
|
||||
cd z2m
|
||||
npm ci
|
||||
node scripts/generateChangelog.js $MASTER_Z2M_VERSION $MASTER_ZHC_VERSION $MASTER_ZH_VERSION >> ../changelog.txt
|
||||
env:
|
||||
GH_TOKEN: ${{secrets.GH_TOKEN}}
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
bodyFile: changelog.txt
|
||||
prerelease: true
|
||||
name: latest-dev
|
||||
allowUpdates: true
|
||||
tag: latest-dev
|
||||
- name: Upload changelog
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: changelog
|
||||
path: changelog.txt
|
||||
|
||||
- create-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [release-please]
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
ref: dev
|
||||
- uses: google-github-actions/release-please-action@v3
|
||||
id: release
|
||||
with:
|
||||
release-type: node
|
||||
package-name: release-please-action
|
||||
default-branch: dev
|
||||
token: ${{secrets.GH_TOKEN}}
|
||||
- name: Download changelog
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: changelog
|
||||
path: ../changelog.txt
|
||||
- uses: ncipollo/release-action@v1
|
||||
name: Create release
|
||||
with:
|
||||
bodyFile: ../changelog.txt
|
||||
draft: true
|
||||
name: ${{ needs.release-please.outputs.version }}
|
||||
tag: ${{ needs.release-please.outputs.version }}
|
||||
- name: Merge dev -> master
|
||||
uses: devmasx/merge-branch@master
|
||||
with:
|
||||
type: now
|
||||
from_branch: dev
|
||||
target_branch: master
|
||||
github_token: ${{secrets.GH_TOKEN}}
|
||||
- name: Promote to dev
|
||||
run: |
|
||||
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package.json > package.json
|
||||
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package-lock.json > package-lock.json
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Promote to dev
|
||||
|
||||
# Checkout repos
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: koenkk/zigbee2mqtt
|
||||
path: ./z2m
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: koenkk/zigbee2mqtt
|
||||
path: ./z2m-master
|
||||
ref: master
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: koenkk/zigbee2mqtt
|
||||
path: ./z2m-changelog
|
||||
ref: release-please--branches--dev--components--release-please-action
|
||||
|
||||
- name: Update latest-dev tag
|
||||
run: |
|
||||
cd z2m
|
||||
git push --delete origin latest-dev
|
||||
git tag latest-dev
|
||||
git push origin latest-dev
|
||||
- name: Update latest-dev release changelog
|
||||
run: |
|
||||
PR=$(echo '${{ steps.release.outputs.pr }}' | jq -r '.number')
|
||||
MASTER_Z2M_VERSION=$(cat z2m-master/package.json | jq -r '.version')
|
||||
MASTER_ZHC_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman-converters"')
|
||||
MASTER_ZH_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman"')
|
||||
cp z2m-changelog/CHANGELOG.md z2m
|
||||
cd z2m
|
||||
npm ci
|
||||
node scripts/generateChangelog.js $MASTER_Z2M_VERSION $MASTER_ZHC_VERSION $MASTER_ZH_VERSION >> ../changelog.txt
|
||||
env:
|
||||
GH_TOKEN: ${{secrets.GH_TOKEN}}
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
bodyFile: changelog.txt
|
||||
prerelease: true
|
||||
name: latest-dev
|
||||
allowUpdates: true
|
||||
tag: latest-dev
|
||||
- name: Upload changelog
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: changelog
|
||||
path: changelog.txt
|
||||
|
||||
create_release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [release-please]
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: dev
|
||||
token: ${{secrets.GH_TOKEN}}
|
||||
- name: Download changelog
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: changelog
|
||||
path: ../changelog.txt
|
||||
- uses: ncipollo/release-action@v1
|
||||
name: Create release
|
||||
with:
|
||||
bodyFile: ../changelog.txt
|
||||
draft: true
|
||||
name: ${{ needs.release-please.outputs.version }}
|
||||
tag: ${{ needs.release-please.outputs.version }}
|
||||
- name: Merge dev -> master
|
||||
uses: devmasx/merge-branch@master
|
||||
with:
|
||||
type: now
|
||||
from_branch: dev
|
||||
target_branch: master
|
||||
github_token: ${{secrets.GH_TOKEN}}
|
||||
- name: Promote to dev
|
||||
run: |
|
||||
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package.json > package.json
|
||||
jq '.version = "${{ needs.release-please.outputs.version }}-dev"' package-lock.json > package-lock.json
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Promote to dev
|
||||
|
||||
Reference in New Issue
Block a user