From 00b6f689833e5494219e052f8d599436ad8c74f8 Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Tue, 23 Apr 2024 17:53:09 +0100 Subject: [PATCH] feat: make inclusion of snap name in tag optional --- release-to-candidate/README.md | 1 + release-to-candidate/action.yaml | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/release-to-candidate/README.md b/release-to-candidate/README.md index baebc1b..2ee4e56 100644 --- a/release-to-candidate/README.md +++ b/release-to-candidate/README.md @@ -29,6 +29,7 @@ jobs: | `architecture` | The architecture for which to build the snap. | N | `amd64` | | `channel` | The channel to release the snap to. | N | `latest/candidate` | | `launchpad-token` | A token with permissions to create Launchpad remote builds. | Y | | +| `multi-snap` | Whether the repo contains the source for multiple snaps. | N | `false` | | `repo-token` | A token with privileges to create and push tags to the repository. | Y | | `snapcraft-project-root` | The path to the Snapcraft YAML file. | N | | | `snapcraft-channel` | The channel to install Snapcraft from. | N | `latest/stable` | diff --git a/release-to-candidate/action.yaml b/release-to-candidate/action.yaml index 8853a23..1fc7eba 100644 --- a/release-to-candidate/action.yaml +++ b/release-to-candidate/action.yaml @@ -17,6 +17,10 @@ inputs: launchpad-token: description: "A token with permissions to create remote builds on Launchpad" required: true + multi-snap: + description: "Whether the repo contains the source for multiple snaps" + required: false + default: "false" repo-token: required: true description: A token with privileges to create and push tags to the repository. @@ -129,6 +133,7 @@ runs: - name: Create tag shell: bash env: + multi_snap: ${{ inputs.multi-snap }} name: ${{ steps.snapcraft-yaml.outputs.snap-name }} version: ${{ steps.snapcraft-yaml.outputs.version }} run: | @@ -136,7 +141,12 @@ runs: git config --global user.email 'merlijn.sebrechts+snapcrafters-bot@gmail.com' revision="${{ steps.publish.outputs.revision }}" - tag_name="${name}-${version}/rev${revision}/${{ inputs.architecture }}" + + if [[ "${multi_snap}" == "true" ]]; then + tag_name="${name}-${version}/rev${revision}/${{ inputs.architecture }}" + else + tag_name="${version}/rev${revision}/${{ inputs.architecture }}" + fi git tag -a "$tag_name" -m "Revision ${revision}, released for ${{ inputs.architecture }}" git push origin "$tag_name"