fix(oci): drop a moved tag from its previous manifest's tag set #135
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright The ORAS Authors. | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.event.pull_request.head.repo.full_name == github.repository | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.merge_commit_sha }} | |
| # Must belong to an org owner so the protected-tag ruleset bypass applies. | |
| # Rotate the repository secret before its PAT expires. | |
| token: ${{ secrets.RELEASE_PAT }} | |
| - name: Set up Go | |
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| check-latest: true | |
| - name: Extract version from branch name | |
| id: version | |
| env: | |
| BRANCH: ${{ github.head_ref }} | |
| run: | | |
| VERSION="${BRANCH#release/}" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Validate semantic version | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| if ! [[ "$VERSION" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(alpha|beta|rc)\.[0-9]+)?$ ]]; then | |
| echo "Error: '$VERSION' does not follow semantic versioning" | |
| echo "Expected: vX.Y.Z or vX.Y.Z-(alpha|beta|rc).N" | |
| exit 1 | |
| fi | |
| - name: Create and push tag | |
| env: | |
| MERGE_COMMIT: ${{ github.event.pull_request.merge_commit_sha }} | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag "$VERSION" "$MERGE_COMMIT" | |
| git push origin "$VERSION" | |
| - name: Write release notes from PR body | |
| env: | |
| NOTES: ${{ github.event.pull_request.body }} | |
| run: printf '%s\n' "$NOTES" > /tmp/release-notes.md | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3 | |
| with: | |
| version: latest | |
| args: release --clean --release-notes /tmp/release-notes.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |