|
| 1 | +name: (Manual) Update Version |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + type: |
| 7 | + description: Bump type |
| 8 | + required: true |
| 9 | + default: patch |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - patch |
| 13 | + - minor |
| 14 | + - major |
| 15 | + - set |
| 16 | + version: |
| 17 | + description: Explicit version when type="set" (e.g., v1.2.3) |
| 18 | + required: false |
| 19 | + default: '' |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: write |
| 23 | + pull-requests: write |
| 24 | + packages: write |
| 25 | + |
| 26 | +jobs: |
| 27 | + update: |
| 28 | + name: Update version and push release branch |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v5 |
| 33 | + with: |
| 34 | + fetch-depth: 0 |
| 35 | + fetch-tags: true |
| 36 | + |
| 37 | + - name: Install Task |
| 38 | + |
| 39 | + with: |
| 40 | + version: 3.x |
| 41 | + |
| 42 | + - name: Update version |
| 43 | + id: version |
| 44 | + env: |
| 45 | + BUMP_TYPE: ${{ github.event.inputs.type }} |
| 46 | + INPUT_VERSION: ${{ github.event.inputs.version }} |
| 47 | + run: | |
| 48 | + set -eux |
| 49 | + case "${BUMP_TYPE}" in |
| 50 | + set) |
| 51 | + if [ -z "${INPUT_VERSION}" ]; then |
| 52 | + echo "Missing version for type=set" |
| 53 | + exit 1 |
| 54 | + fi |
| 55 | + task version:set VERSION_OVERRIDE="${INPUT_VERSION}" |
| 56 | + ;; |
| 57 | + patch) |
| 58 | + task version:update:patch |
| 59 | + ;; |
| 60 | + minor) |
| 61 | + task version:update:minor |
| 62 | + ;; |
| 63 | + major) |
| 64 | + task version:update:major |
| 65 | + ;; |
| 66 | + *) |
| 67 | + echo "Unknown type: ${BUMP_TYPE}" |
| 68 | + exit 1 |
| 69 | + ;; |
| 70 | + esac |
| 71 | + echo "REL_VERSION=$(task version:get)" >> "$GITHUB_OUTPUT" |
| 72 | +
|
| 73 | + - name: Install Docker Buildx |
| 74 | + uses: docker/setup-buildx-action@v3 |
| 75 | + with: |
| 76 | + install: true |
| 77 | + |
| 78 | + - name: Install QEMU |
| 79 | + uses: docker/setup-qemu-action@v3 |
| 80 | + with: |
| 81 | + image: tonistiigi/binfmt:latest |
| 82 | + platforms: amd64,arm64 |
| 83 | + |
| 84 | + - name: Get Docker commands |
| 85 | + run: task docker:cmds |
| 86 | + |
| 87 | + - name: Build and push test image |
| 88 | + env: |
| 89 | + DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + run: task docker:push |
| 92 | + |
| 93 | + - name: Inspect image |
| 94 | + run: task docker:push:inspect |
| 95 | + |
| 96 | + - name: Get template |
| 97 | + env: |
| 98 | + VERSION_SUFFIX: "" |
| 99 | + run: | |
| 100 | + task git:set-config |
| 101 | + task git:get-pr-template |
| 102 | +
|
| 103 | + - name: Push to release branch |
| 104 | + uses: devops-infra/action-commit-push@v1 |
| 105 | + with: |
| 106 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 107 | + commit_message: ":rocket: Bump version to ${{ steps.version.outputs.REL_VERSION }}" |
| 108 | + target_branch: ${{ format('release/{0}', steps.version.outputs.REL_VERSION) }} |
| 109 | + |
| 110 | + - name: Create Pull Request |
| 111 | + uses: devops-infra/action-pull-request@v1 |
| 112 | + with: |
| 113 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 114 | + assignee: ${{ github.actor }} |
| 115 | + template: .tmp/PULL_REQUEST_TEMPLATE.md |
| 116 | + get_diff: true |
0 commit comments