From 7118fb1923337466f16241648a9d016b2e92a183 Mon Sep 17 00:00:00 2001 From: Josh Willox Date: Mon, 10 Jun 2024 15:42:01 +1000 Subject: [PATCH] ci: update release workflow --- .github/actions/addon-info/action.yml | 8 ++-- .github/workflows/publish.yaml | 44 ++++++++++++++++++ .github/workflows/release.yaml | 55 +++++++++++++++++++++++ .github/workflows/release.yml | 53 ---------------------- .github/workflows/{test.yml => test.yaml} | 0 rclone_backup/CHANGELOG.md | 31 +++++++------ 6 files changed, 121 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/publish.yaml create mode 100644 .github/workflows/release.yaml delete mode 100644 .github/workflows/release.yml rename .github/workflows/{test.yml => test.yaml} (100%) diff --git a/.github/actions/addon-info/action.yml b/.github/actions/addon-info/action.yml index 917aa84..26a6ba1 100644 --- a/.github/actions/addon-info/action.yml +++ b/.github/actions/addon-info/action.yml @@ -30,10 +30,10 @@ runs: repository="$(echo "$raw_image" | cut -f 1 -d '/')" image="$(echo "$raw_image" | cut -f 2- -d '/')" - echo "::set-output name=name::${name}" - echo "::set-output name=description::${description}" - echo "::set-output name=repository::${repository}" - echo "::set-output name=image::${image}" + echo "name=${name}" >> $GITHUB_OUTPUT + echo "description=${description}" >> $GITHUB_OUTPUT + echo "repository=${repository}" >> $GITHUB_OUTPUT + echo "image=${image}" >> $GITHUB_OUTPUT yq -i ".args.BUILD_NAME=\"${name}\"" $TARGET/build.yaml yq -i ".args.BUILD_DESCRIPTION=\"${description}\"" $TARGET/build.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..9528dda --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,44 @@ +name: "Publish" + +on: + release: + types: [published] + +env: + TARGET: rclone_backup + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write + steps: + - name: "Checkout the repository" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: main + + - name: "Get addon information and update build args" + id: information + uses: ./.github/actions/addon-info + + - name: "Login to GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: "Publish" + uses: home-assistant/builder@master + with: + args: | + --all \ + --target ${{ env.TARGET }} \ + --image ${{ steps.information.outputs.image }} \ + --docker-hub ${{ steps.information.outputs.repository }} \ + --release ${{ github.event.release.tag_name }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..7bcf371 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,55 @@ +name: "Release" + +on: + push: + branches: + - "beta" + - "alpha" + workflow_dispatch: + inputs: + draft: + type: boolean + description: "Draft release" + default: false + release_type: + type: choice + description: "Release type" + default: "auto" + options: + - "auto" + - "patch" + - "minor" + - "major" + +env: + TARGET: "rclone_backup" + +jobs: + publish: + name: "Publish" + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write + steps: + - name: "Checkout the repository" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: "Setup node" + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: "Release Package 📦" + run: corepack enable && pnpm dlx @jcwillox/semantic-release-config + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SEMANTIC_RELEASE_GITHUB_DRAFT: ${{ inputs.draft }} + SEMANTIC_RELEASE_FORCE_RELEASE: ${{ inputs.release_type }} + SEMANTIC_RELEASE_CHANGELOG_FILE: "${{ env.TARGET }}/CHANGELOG.md" + SEMANTIC_RELEASE_CMD_PREPARE: "yq -i '.version = \"${nextRelease.version}\"' ${{ env.TARGET }}/config.yaml" + SEMANTIC_RELEASE_GIT_ASSETS: '["${{ env.TARGET }}/CHANGELOG.md", "${{ env.TARGET }}/config.yaml"]' + SEMANTIC_RELEASE_GIT_MESSAGE: "release: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7729c0c..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: "Publish" - -on: - release: - types: [published] - -env: - TARGET: rclone_backup - -jobs: - publish: - name: Publish - runs-on: ubuntu-latest - steps: - - name: "Checkout the repository" - uses: actions/checkout@v4 - with: - ref: main - - - name: "Update version and changelog" - run: | - yq -i '.version = "${{ github.event.release.tag_name }}"' $TARGET/config.yaml - - echo -e "## What’s changed\n" > $TARGET/CHANGELOG.md - jq --raw-output '.release.body // empty' "${{ github.event_path }}" >> $TARGET/CHANGELOG.md - - - name: "Commit & push changes" - run: | - git config user.name github-actions - git config user.email github-actions@github.com - git add . - git commit -m "🎉 Release ${{ github.event.release.tag_name }}" - git push - - - name: "Get addon information and update build args" - id: information - uses: ./.github/actions/addon-info - - - name: "Login to GitHub Container Registry" - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: "Publish" - uses: home-assistant/builder@master - with: - args: | - --all \ - --target ${{ env.TARGET }} \ - --image ${{ steps.information.outputs.image }} \ - --docker-hub ${{ steps.information.outputs.repository }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yaml similarity index 100% rename from .github/workflows/test.yml rename to .github/workflows/test.yaml diff --git a/rclone_backup/CHANGELOG.md b/rclone_backup/CHANGELOG.md index f1cdb54..3978bd3 100644 --- a/rclone_backup/CHANGELOG.md +++ b/rclone_backup/CHANGELOG.md @@ -1,13 +1,18 @@ -## What’s changed - -## What's Changed - -* build(deps): update actions/checkout action to v4 by @renovate in https://github.com/jcwillox/hassio-rclone-backup/pull/62 -* build(deps): update docker/login-action action to v3 by @renovate in https://github.com/jcwillox/hassio-rclone-backup/pull/63 -* build(deps): update all non-major dependencies by @renovate in https://github.com/jcwillox/hassio-rclone-backup/pull/61 - * updated to `rclone` to `v1.66.0` -* build(deps): update module github.com/go-co-op/gocron to v2 by @renovate in https://github.com/jcwillox/hassio-rclone-backup/pull/64 -* build(deps): update go.mod version to 1.22 (dd73c29) -* ci: add renovate config (2bb7d50) - -**Full Changelog**: https://github.com/jcwillox/hassio-rclone-backup/compare/3.1.0...3.2.0 +# Changelog + +## 3.2.0 + +### 📦 Build + +* **deps:** Update actions/checkout action to v4 ([#62](https://github.com/jcwillox/hassio-rclone-backup/pull/62)) +* **deps:** Update docker/login-action action to v3 ([#63](https://github.com/jcwillox/hassio-rclone-backup/pull/63)) +* **deps:** Update all non-major dependencies ([#61](https://github.com/jcwillox/hassio-rclone-backup/pull/61)) + * updated to `rclone` to `v1.66.0` +* **deps:** Update module github.com/go-co-op/gocron to v2 ([#64](https://github.com/jcwillox/hassio-rclone-backup/pull/64)) +* **deps:** Update go.mod version to 1.22 ([dd73c29](https://github.com/jcwillox/hassio-rclone-backup/commit/dd73c2914c96c95aaa0d1262492d5caa1bf3fc39)) + +### ⚙️ Continuous Integration + +* Add renovate config ([2bb7d50](https://github.com/jcwillox/hassio-rclone-backup/commit/2bb7d50ec5202c565afe462fa87f7c478928d9ad)) + +**Full Changelog**: [`3.1.0...3.2.0`](https://github.com/jcwillox/hassio-rclone-backup/compare/3.1.0...3.2.0)