diff --git a/.github/workflows/major-version-updater.yaml b/.github/workflows/major-version-updater.yaml index a8ec77f..5e07984 100644 --- a/.github/workflows/major-version-updater.yaml +++ b/.github/workflows/major-version-updater.yaml @@ -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: @@ -17,17 +20,19 @@ jobs: - uses: actions/checkout@v4.2.2 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 }} diff --git a/.github/workflows/release-discussion.yaml b/.github/workflows/release-discussion.yaml index 4a2e70a..b3ed0d8 100644 --- a/.github/workflows/release-discussion.yaml +++ b/.github/workflows/release-discussion.yaml @@ -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 }} diff --git a/.github/workflows/release-image.yaml b/.github/workflows/release-image.yaml index 7a32629..111056d 100644 --- a/.github/workflows/release-image.yaml +++ b/.github/workflows/release-image.yaml @@ -40,9 +40,9 @@ jobs: steps: - uses: actions/checkout@v4.2.2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 + uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 - name: Log in to the Container registry - uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 + uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 with: registry: ${{ env.IMAGE_REGISTRY }} username: ${{ env.IMAGE_REGISTRY_USERNAME }} @@ -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 }} diff --git a/.github/workflows/test-major-version-updater.yaml b/.github/workflows/test-major-version-updater.yaml index 20e00d0..62c7627 100644 --- a/.github/workflows/test-major-version-updater.yaml +++ b/.github/workflows/test-major-version-updater.yaml @@ -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 }} diff --git a/README.md b/README.md index 9d5726f..dea0f8b 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/major-version-updater.md b/docs/major-version-updater.md new file mode 100644 index 0000000..81d77aa --- /dev/null +++ b/docs/major-version-updater.md @@ -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