From 76067b5d19a3f807e6bafcdcaefbeb2592d57bd1 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Mon, 12 Feb 2024 19:32:55 +0100 Subject: [PATCH 1/4] ci: add release job to build workflow Signed-off-by: Reuben Miller --- .github/workflows/build-workflow.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/build-workflow.yml b/.github/workflows/build-workflow.yml index b62a1060e28..ee391d080e1 100644 --- a/.github/workflows/build-workflow.yml +++ b/.github/workflows/build-workflow.yml @@ -325,3 +325,23 @@ jobs: run: | just publish-linux-virtual --repo tedge-main just publish-linux-virtual --repo tedge-main-armv6 + + release: + runs-on: ubuntu-latest + needs: [publish-virtual-packages, publish-containers] + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + generate_release_notes: true + draft: true + + - name: Create tedge-docs snapshot + run: | + gh workflow run snapshot.yml -R thin-edge/tedge-docs -f version=${{github.ref_name}} + env: + # Triggering another workflow requires more additional credentials + GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} From edb5613ebf00f2060115d248a36e09be0aa9f70b Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Mon, 12 Feb 2024 19:33:39 +0100 Subject: [PATCH 2/4] ci: use PAT to create PR which will trigger actions Signed-off-by: Reuben Miller --- .github/workflows/hosted-post-merge_version_update.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/hosted-post-merge_version_update.yml b/.github/workflows/hosted-post-merge_version_update.yml index c23bce0a05e..d5a99095014 100644 --- a/.github/workflows/hosted-post-merge_version_update.yml +++ b/.github/workflows/hosted-post-merge_version_update.yml @@ -23,10 +23,15 @@ env: jobs: versioning: runs-on: ubuntu-20.04 + permissions: + contents: write + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false - run: | git config --global user.email "info@thin-edge.io" git config --global user.name "Versioneer" @@ -58,3 +63,4 @@ jobs: title: ${{ inputs.bump }} version bump body: ${{ inputs.bump }} version bump reviewers: rina23q + token: ${{ secrets.ACTIONS_PAT }} From 03a59b4b438081f5dee3941b28d5c66a229239a6 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Mon, 12 Feb 2024 19:39:00 +0100 Subject: [PATCH 3/4] add workflow to generate a tag when new package version is detected Signed-off-by: Reuben Miller --- .github/workflows/autotag.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/autotag.yml diff --git a/.github/workflows/autotag.yml b/.github/workflows/autotag.yml new file mode 100644 index 00000000000..54a64fa7d40 --- /dev/null +++ b/.github/workflows/autotag.yml @@ -0,0 +1,31 @@ +name: autotag +# +# Create a git tag based on the Cargo workflow packages version if one does not already exist +# The tag will trigger the release process (as it is triggered via tagging) +# +on: + push: + branches: [main] +jobs: + create_tag: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Create tag if changed + if: github.repository_owner == 'thin-edge' + run: | + VERISON=$(yq '.workspace.package.version' Cargo.toml) + if [ -z "$VERISON" ]; then + echo "Could not detect workspace package version (.workspace.package.version) from Cargo.toml" + exit 1 + fi + if [ -n $(git tag -l "$VERSION") ]; then + echo "Skipping as tag already exists" + exit 0 + fi + echo "Creating tag: $VERSION" + git tag -a "$VERSION" -m "Release $VERSION" + git push origin "$VERSION" From b76bad83f8bfb7f5dbacba12432e439ccb646c78 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Mon, 12 Feb 2024 20:54:51 +0100 Subject: [PATCH 4/4] remove explicit reviewers as code owners is used instead Signed-off-by: Reuben Miller --- .github/workflows/hosted-post-merge_version_update.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/hosted-post-merge_version_update.yml b/.github/workflows/hosted-post-merge_version_update.yml index d5a99095014..6a06995d7e3 100644 --- a/.github/workflows/hosted-post-merge_version_update.yml +++ b/.github/workflows/hosted-post-merge_version_update.yml @@ -62,5 +62,4 @@ jobs: delete-branch: true title: ${{ inputs.bump }} version bump body: ${{ inputs.bump }} version bump - reviewers: rina23q token: ${{ secrets.ACTIONS_PAT }}