Automated releases when Forgejo is published #967

Open
opened 2024-11-15 20:56:36 +00:00 by earl-warren · 0 comments
Contributor

The Forgejo release process could notify the helm chart that a release was published, in the same way to already does for the mirror, by adding a tag to an issue. And that could trigger the new chart release process so it is fully automated.

This is what the Forgejo release process could do:

- name: get trigger mirror issue
id: mirror
uses: https://code.forgejo.org/infrastructure/issue-action/get@v1.1.0
with:
forgejo: https://code.forgejo.org
repository: forgejo/forgejo
labels: mirror-trigger
- name: trigger the mirror
uses: https://code.forgejo.org/infrastructure/issue-action/set@v1.1.0
with:
forgejo: https://code.forgejo.org
repository: forgejo/forgejo
token: ${{ secrets.LABEL_ISSUE_FORGEJO_MIRROR_TOKEN }}
numbers: ${{ steps.mirror.outputs.numbers }}
label-wait-if-exists: 3600
label: trigger

And the forgejo-helm workflow would looks like this. When an issue is labeled:

If it is assigned to the right user and has the expected label, it prepares and publishes the release.

if: contains(github.event.issue.assignees.*.login, 'forgejo-read-only-issues') && github.event.label.name == 'trigger'

When it is done, it clears the label.

- name: clear the trigger label
if: always()
uses: https://code.forgejo.org/infrastructure/issue-action/set@v1.0.0
with:
forgejo: https://${{ vars.DESTINATION }}
repository: ${{ vars.OWNER }}/forgejo
token: ${{ secrets.LABEL_ISSUE_FORGEJO_MIRROR_TOKEN }}
numbers: ${{ github.event.issue.number }}
unlabel: trigger

Used in this way the label being set acts as an exclusive lock and guarantees no two releases are built simultaneously.

The Forgejo release process could notify the helm chart that a release was published, in the same way to already does for the mirror, by adding a tag to [an issue](https://code.forgejo.org/forgejo/forgejo/issues/5). And that could trigger the new chart release process so it is fully automated. This is what the Forgejo release process could do: https://code.forgejo.org/forgejo/forgejo/src/commit/b21cc70dd7296450b3191795beecfa651cf74ee8/.forgejo/workflows/publish-release.yml#L62-L79 And the forgejo-helm workflow would looks like this. When an issue is labeled: https://code.forgejo.org/forgejo/forgejo/src/commit/40ece122e70234fe74e8ca4a4e43353de04538a9/.forgejo/workflows/mirror-releases.yml#L6-L9 If it is assigned to the right user and has the expected label, it prepares and publishes the release. https://code.forgejo.org/forgejo/forgejo/src/commit/40ece122e70234fe74e8ca4a4e43353de04538a9/.forgejo/workflows/mirror-releases.yml#L12 When it is done, it clears the label. https://code.forgejo.org/forgejo/forgejo/src/commit/40ece122e70234fe74e8ca4a4e43353de04538a9/.forgejo/workflows/mirror-releases.yml#L94-L102 Used in this way the label being set acts as an exclusive lock and guarantees no two releases are built simultaneously.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
forgejo-helm/forgejo-helm#967
No description provided.