Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create tags for new revisions published to the store #23

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions release-to-candidate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | `candidate` |
| `launchpad-token` | A token with permissions to create Launchpad remote builds. | Y | |
| `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 | |
| `store-token` | A token with permissions to upload and release to the specified channel in the Snap Store | Y | |

Expand Down
20 changes: 20 additions & 0 deletions release-to-candidate/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ inputs:
launchpad-token:
description: "A token with permissions to create remote builds on Launchpad"
required: true
repo-token:
required: true
description: A token with privileges to create and push tags to the repository.
snapcraft-project-root:
description: "The root of the snapcraft project, where the `snapcraft` command would usually be executed from."
required: false
Expand All @@ -34,6 +37,8 @@ runs:
steps:
- name: Checkout the source
uses: actions/checkout@v4
with:
token: ${{ inputs.repo-token }}

- name: Setup snapcraft
shell: bash
Expand Down Expand Up @@ -108,3 +113,18 @@ runs:
with:
name: "manifests"
path: "manifest-${{ inputs.architecture }}.yaml"

# Create a tag in the repo that corresponds to the revision pushed
- name: Create tag
shell: bash
env:
version: ${{ steps.snapcraft-yaml.outputs.version }}
run: |
git config --global user.name 'Snapcrafters Bot'
git config --global user.email '[email protected]'

revision="${{ steps.publish.outputs.revision }}"
tag_name="${version}/rev${revision}/${{ inputs.architecture }}"

git tag -a "$tag_name" -m "Revision ${revision}, released for ${{ inputs.architecture }}"
git push origin "$tag_name"