Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
feat: create module tags once release is published
Browse files Browse the repository at this point in the history
  • Loading branch information
paralta committed Feb 29, 2024
1 parent f37c46a commit 4254c0e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 32 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/post-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Post Release
on:
release:
types: [published]

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.modules.outputs.modules }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Get modules
id: modules
run: |
echo "modules=$(find . -name go.mod -exec dirname {} \; | sed 's/^\.\///' | jq -R . | jq -s .)"
create_module_tags:
needs:
- prepare
name: Create module tags
runs-on: ubuntu-latest
strategy:
matrix:
tags: ${{ fromJson(needs.prepare.outputs.modules) }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Create tags
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ matrix.tags }}/${{ github.ref_name }}',
sha: context.sha
})
22 changes: 0 additions & 22 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,3 @@ jobs:
draft: true
name: "Release ${{ github.ref_name }}"
updateOnlyUnreleased: true

# TODO(sambetts) We need to publish a tag in the format "api/<version>" tag
# so that go mod is able to import the api module without overriding. We need
# to work out how to do this cleanly from github actions on release so that
# we don't need to manage it manually. We could do something this which will
# create another release:
#
# api_release:
# needs: release
# name: Release API Module
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Release API
# uses: softprops/action-gh-release@v1
# with:
# name: VMClarity {{ github.ref }} API
# body: See main {{ github.ref }} release for release notes.
# tag_name: api/{{ github.ref }}
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,3 @@ multimod-verify: bin/multimod
.PHONY: multimod-prerelease
multimod-prerelease: bin/multimod
$(MULTIMOD_BIN) prerelease --all-module-sets --skip-go-mod-tidy=true --commit-to-different-branch=false

.PHONY: multimod-push-tags
multimod-push-tags: bin/multimod
set -e; for tag in `$(MULTIMOD_BIN) tag --module-set-name vmclarity --commit-hash HEAD --print-tags | grep -v "Using" `; do \
echo "pushing tag $${tag}"; \
git push origin $${tag}; \
done;
9 changes: 6 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ make multimod-prerelease
git push origin release/v0.7.0
```

* Create a pull request with the changes.
* Create a pull request for these changes with a title like "release: prepare version v0.7.0".

## 3. Create and Push Tags

Expand All @@ -51,11 +51,14 @@ git checkout main
git pull origin main
```

* Create and push the tags for the last commit to the repository.
* To trigger the release workflow, create and push to the repository a release tag for the last commit.
```sh
make multimod-push-tags
git tag -a v0.7.0
git push origin v0.7.0
```

Please note that the release tag is not necessarily associated with the "release: prepare version v0.7.0" commit. For example, if any bug fixes were required after this commit, they can be merged and included in the release.

## Post-release Checks
Verify that the `Release` workflow was completed successfully in the GitHub Actions section.
Ensure that the release is visible in the GitHub releases page. Additionally, check that the release description is correct and all assets are listed.

0 comments on commit 4254c0e

Please sign in to comment.