Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Conversation

@galargh
Copy link
Contributor

@galargh galargh commented Feb 24, 2022

Resolved #228

Description

This PR builds up on #295. It is currently targeted at that PR. It can be retargeted to next once that PR is merged.

In this PR I refactor release-check and releaser workflows in such a way that enables adding GitHub Release creation to the process. I propose for a draft GitHub Release to be created during release-check and for that draft to be published during release. release-check will post a link to the draft as a comment. The draft can be modified or deleted manually - those actions will be respected by the release.

I describe what the refactored workflows are doing below.

release-check
  1. Retrieve version from version.json through GitHub API
  2. Check if a tag for the retrieved version already exists - exit if it does
  3. Check if version is valid
  4. Check if a draft GitHub release for the version already exists - create if it does not
  5. Find previous version
  6. Run diff, gorelease and gocompat if a previous version exists
  7. Post a comment on the PR
release
  1. Retrieve version from version.json through GitHub API
  2. Check if there exists a PR associated with the commit which is merged and has release label on it - exit if not on a default branch and such a PR does not exist
  3. Check if a draft GitHub release for the version exists - publish the release if it does, publish the tag otherwise
Testing

Default branch

Release branch

@galargh galargh changed the base branch from master to pr-target-release-check February 24, 2022 12:37
galargh added a commit to galorgh/go-ipfs-cmds that referenced this pull request Feb 24, 2022
@galargh galargh force-pushed the github-release branch 11 times, most recently from 4242e0a to a230d86 Compare February 24, 2022 14:29
galargh added a commit to galorgh/go-ipfs-cmds that referenced this pull request Feb 24, 2022
@galargh galargh force-pushed the github-release branch 2 times, most recently from 1186400 to 96c2ec8 Compare February 24, 2022 14:39
@galargh galargh force-pushed the github-release branch 3 times, most recently from 703a7d3 to 4c73325 Compare February 24, 2022 16:58
@galargh galargh changed the title WIP: GitHub Release flow Create GitHub releases in releaser/tag-pusher workflows Feb 25, 2022
@galargh galargh marked this pull request as ready for review February 25, 2022 09:29
@galargh galargh requested a review from a team as a code owner November 14, 2022 12:29
@galargh galargh requested a review from laurentsenta November 14, 2022 12:29
@galargh galargh self-assigned this Nov 14, 2022
# Check if a git tag for the version (as read from version.json) exists
# If that is the case, we don't need to run the rest of the workflow.
if: env.VERSION != ''
echo "::set-output name=this::$version"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if: env.TAG_EXISTS == 'false'
run: npm install -g "https://github.com/npm/node-semver#e79ac3a450e8bb504e78b8159e3efc7089569" # v7.3.5
# https://docs.github.com/en/rest/reference/git#get-a-reference
gh api '/repos/${{ github.repository }}/git/ref/tags/${{ steps.version.outputs.this }}' && tag_exists='true' || tag_exists='false'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using string interpolation at the yml level here, is it possible a malformed value in steps.version.outputs.this turns into a string injection?

Should we use something like:

env:
    TAG_URL: /repos/${{ github.repository }}/git/ref/tags/${{ steps.version.outputs.this }}
run:
    gh api "${TAG_URL}" # using shell's expansion here

?

ref: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable

status=$? && ([[ $status == 0 ]] || exit $status)
fi
echo "COMMENT<<EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@galargh galargh marked this pull request as draft January 5, 2023 09:04
@galargh
Copy link
Contributor Author

galargh commented Jan 5, 2023

Moved back to draft for now. I'm going to asses the comments from @laurentsenta and mark it as ready for review afterwards. Thanks 🙇

@galargh galargh mentioned this pull request Feb 1, 2023
10 tasks
Base automatically changed from pr-target-release-check to next February 1, 2023 19:21
@galargh
Copy link
Contributor Author

galargh commented Feb 1, 2023

Replaced this one with #456

@galargh galargh closed this Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants