Workflow file for this run
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
on: | |
push: | |
branches: | |
- fix/release-please | |
permissions: | |
contents: write | |
pull-requests: write | |
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@v4 | |
with: | |
node-version: 20 | |
- uses: google-github-actions/release-please-action@v4 | |
id: release | |
with: | |
target-branch: dev | |
token: ${{secrets.GH_TOKEN}} | |
- run: | | |
echo "PR" | |
echo ${{ steps.release.outputs.pr }} | |
echo "VERSION" | |
echo ${{ steps.release.outputs.version }} | |
# we use grep,awk,sed here because the output from release-please despite being JSON, it's not valid (probably shell-escaping) and | |
# jq fails to parse it. Creates the output pr_branch | |
- name: Get the branch of the release-please PR | |
id: get_pr_branch | |
if: ${{ steps.release.outputs.prs_created == 'true' }} | |
run: | | |
BRANCH=$(echo '${{ steps.release.outputs.prs }}' | grep -o -P '\"headBranchName\":\"(.*?)\"' | awk -F':' '{print $2}' | tr -d \") | |
echo "pr_branch=${BRANCH}" >> $GITHUB_OUTPUT | |
# Checkout PR branch | |
- uses: actions/checkout@v4 | |
if: ${{ steps.release.outputs.prs_created == 'true' }} | |
with: | |
repository: koenkk/zigbee2mqtt | |
path: ./z2m-pr | |
ref: ${{ steps.get_pr_branch.outputs.pr_branch }} | |
token: ${{secrets.GH_TOKEN}} | |
- name: Add updated helm chart release versions and documentation to release PR | |
if: ${{ steps.release.outputs.prs_created == 'true' }} | |
run: | | |
pushd ./z2m-pr | |
Z2M_VERSION="$(jq -r '."."' .release-please-manifest.json)" | |
yq -i ".appVersion=\"${Z2M_VERSION}\"" charts/zigbee2mqtt/Chart.yaml | |
yq -i ".image.tag=\"${Z2M_VERSION}\"" charts/zigbee2mqtt/values.yaml | |
# Keep chart version in step lock with zigbee2mqtt | |
jq ".\"charts/zigbee2mqtt\"=\"${Z2M_VERSION}\"" .release-please-manifest.json > .release-please-manifest.json.tmp | |
mv .release-please-manifest.json.tmp .release-please-manifest.json | |
go run github.com/norwoodj/helm-docs/cmd/helm-docs@latest | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "chore(release): update helm-chart docs" | |
git push | |
# Checkout repos | |
- uses: actions/checkout@v4 | |
with: | |
repository: koenkk/zigbee2mqtt | |
path: ./z2m | |
- uses: actions/checkout@v4 | |
with: | |
repository: koenkk/zigbee2mqtt | |
path: ./z2m-master | |
ref: master | |
- name: Restore cache commit-user-lookup.json | |
uses: actions/cache/restore@v4 | |
with: | |
path: z2m/scripts/commit-user-lookup.json | |
key: commit-user-lookup-dummy | |
restore-keys: | | |
commit-user-lookup- | |
- name: Generate changelog | |
run: | | |
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"') | |
MASTER_FRONTEND_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee2mqtt-frontend"') | |
wget -q -O - https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/release-please--branches--dev/CHANGELOG.md > z2m/CHANGELOG.md | |
cd z2m | |
npm ci | |
node scripts/generateChangelog.js $MASTER_Z2M_VERSION $MASTER_ZHC_VERSION $MASTER_ZH_VERSION $MASTER_FRONTEND_VERSION >> ../changelog.md | |
env: | |
GH_TOKEN: ${{secrets.GH_TOKEN}} | |
- name: Update changelog gist | |
run: | | |
gh gist edit bfd4c3d1725a2cccacc11d6ba51008ba -a changelog.md | |
env: | |
GH_TOKEN: ${{secrets.GH_TOKEN}} | |
- name: Save cache commit-user-lookup.json | |
uses: actions/cache/save@v4 | |
if: always() | |
with: | |
path: z2m/scripts/commit-user-lookup.json | |
key: commit-user-lookup-${{ hashFiles('z2m/scripts/commit-user-lookup.json') }} |