Skip to content
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
11 changes: 8 additions & 3 deletions .github/workflows/major-version-updater.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ name: "Major Version Updater"
on:
workflow_call:
inputs:
tag_name:
tag-name:
required: true
type: string
secrets:
github-token:
required: true
permissions:
contents: read
jobs:
Expand All @@ -17,17 +20,19 @@ jobs:
- uses: actions/[email protected]
with:
fetch-tags: true
ref: ${{ inputs.tag_name }}
ref: ${{ inputs.tag-name }}
- name: version
id: version
env:
TAG_NAME: ${{ inputs.tag_name }}
TAG_NAME: ${{ inputs.tag-name }}
run: |
tag=${TAG_NAME/refs\/tags\//}
version=${tag#v}
major=${version%%.*}
{ echo "tag=${tag}"; echo "version=${version}"; echo "major=${major}"; } >> "$GITHUB_OUTPUT"
- name: force update major tag
env:
GITHUB_TOKEN: ${{ secrets.github-token }}
run: |
git tag -f v${{ steps.version.outputs.major }} ${{ steps.version.outputs.tag }}
git push -f origin v${{ steps.version.outputs.major }}
3 changes: 1 addition & 2 deletions .github/workflows/release-discussion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ jobs:
exit 1
- name: Create an Announcement Discussion for Release
uses: abirismyname/create-discussion@c2b7c825241769dda523865ae444a879f6bbd0e0
env:
GH_TOKEN: ${{ secrets.github-token }}
with:
title: ${{ inputs.full-tag }}
body: ${{ inputs.body }}
repository-id: ${{ env.DISCUSSION_REPOSITORY_ID }}
category-id: ${{ env.DISCUSSION_CATEGORY_ID }}
github-token: ${{ secrets.github-token }}
1 change: 1 addition & 0 deletions .github/workflows/release-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ jobs:
subject-name: ${{ env.IMAGE_REGISTRY }}/${{ inputs.image-name}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
github-token: ${{ secrets.github-token }}
4 changes: 3 additions & 1 deletion .github/workflows/test-major-version-updater.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ jobs:
contents: write
uses: ./.github/workflows/major-version-updater.yaml
with:
tag_name: ${{ github.event.inputs.TAG_NAME || github.ref}}
tag-name: ${{ github.event.inputs.TAG_NAME || github.ref}}
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ This is a placeholder repo for multiple GitHub Actions we use in open source pro

## Reusable Workflows Available

- [Labeler](docs/labeler.md)
- [Auto-Labeler](docs/auto-labeler.md)
- [Labeler](docs/labeler.md)
- [Major Version Updater](docs/major-version-updater.md)
- [PR Title](docs/pr-title.md)
- [Release](docs/release.md)
- [Release Image](docs/release-image.md)
Expand Down
19 changes: 19 additions & 0 deletions docs/major-version-updater.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Major Version Updater

## Inputs

```yaml
- uses: github/ospo-reusable-workflows/.github/workflows/major-version-updater.yml@main
permissions:
contents: write
with:
# Tag name that the major tag will point to (e.g. v1.2.3)
tag-name: v1.2.3
secrets:
# The GitHub token to use
github-token: ${{ secrets.GITHUB_TOKEN }}
```

## Outputs

None
Loading