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

Commit

Permalink
feat: move module tags creation to pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
paralta committed Feb 26, 2024
1 parent f37c46a commit 668271e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 33 deletions.
62 changes: 39 additions & 23 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,37 @@ jobs:
- artifacts
name: Release
runs-on: ubuntu-latest
strategy:
matrix:
tags:
- "uibackend/types"
- "uibackend/server"
- "uibackend/client"
- "core"
- "provider"
- "utils"
- "installation"
- "cli"
- "testenv"
- "api/types"
- "api/server"
- "api/client"
- "e2e"
- "containerruntimediscovery/types"
- "containerruntimediscovery/server"
- "containerruntimediscovery/client"
- "orchestrator"

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Delete tag used for triggering the release
run: git push origin :${{ github.ref_name }}
continue-on-error: true

- name: Download artifacts
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
Expand All @@ -141,6 +166,18 @@ jobs:
VERSION: ${{ github.ref_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make generate-release-notes

- name: Create tag
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
})
- uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
Expand All @@ -149,27 +186,6 @@ jobs:
artifacts: "dist/*.tar.gz,dist/*.sha256sum,dist/bicep/vmclarity.json,dist/bicep/vmclarity-UI.json"
bodyFile: "dist/CHANGELOG.md"
draft: true
name: "Release ${{ github.ref_name }}"
name: "Release ${{ matrix.tags }}/${{ 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 }}
tag: ${{ matrix.tags }}/${{ github.ref_name }}
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;
7 changes: 4 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ git push origin release/v0.7.0

* Create a pull request with the changes.

## 3. Create and Push Tags
## 3. Create and Push Tag

* After the pull request is approved and merged, update your local main branch.
```sh
git checkout main
git pull origin main
```

* Create and push the tags for the last commit to the repository.
* Create and push a new tag in order to trigger the `Release` workflow.
```sh
make multimod-push-tags
git tag -a v0.7.0
git push origin v0.7.0
```

## Post-release Checks
Expand Down

0 comments on commit 668271e

Please sign in to comment.