|
1 | 1 | name: Releases
|
| 2 | + |
2 | 3 | on:
|
3 | 4 | push:
|
4 |
| - branches: |
5 |
| - - master-dev |
6 |
| - |
7 |
| -env: |
8 |
| - PUSH: 'true' |
9 |
| - PRE_RELEASE: GA |
10 |
| - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
11 |
| - GO_VERSION: "1.22.0" |
| 5 | + tags: |
| 6 | + - v* |
12 | 7 |
|
13 | 8 | permissions:
|
14 | 9 | contents: write
|
15 | 10 | packages: write
|
16 | 11 |
|
17 | 12 | jobs:
|
18 | 13 | releases:
|
19 |
| - name: release |
| 14 | + name: Create draft release |
20 | 15 | runs-on: ubuntu-latest
|
21 | 16 | steps:
|
22 |
| - - name: Clone the code |
23 |
| - uses: actions/checkout@v4 |
24 |
| - - name: Setup Go |
25 |
| - uses: actions/setup-go@v5 |
26 |
| - with: |
27 |
| - go-version: '~1.22' |
28 |
| - - name: Set up QEMU |
29 |
| - uses: docker/setup-qemu-action@v3 |
30 |
| - - name: Set up Docker Buildx |
31 |
| - uses: docker/setup-buildx-action@v3 |
32 |
| - - name: Log into registry ghcr.io |
33 |
| - uses: docker/login-action@v3 |
34 |
| - with: |
35 |
| - registry: ghcr.io |
36 |
| - username: ${{ github.actor }} |
37 |
| - password: ${{ secrets.GITHUB_TOKEN }} |
38 |
| - - name: Build and push |
39 |
| - run: | |
40 |
| - make docker-buildx |
| 17 | + - name: Clone the code |
| 18 | + uses: actions/checkout@v4 |
| 19 | + - name: Set version info |
| 20 | + run: | |
| 21 | + echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV |
| 22 | + PREVIOUS_VERSION=$(git tag --sort=-creatordate | sed -n 2p) |
| 23 | + if [ -z "$PREVIOUS_VERSION" ]; then |
| 24 | + PREVIOUS_VERSION=$(git rev-list --max-parents=0 HEAD) |
| 25 | + fi |
| 26 | + echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_ENV |
| 27 | + echo "RELEASE_BRANCH=release-$(echo ${GITHUB_REF_NAME} | grep -Eo '[0-9]\.[0-9]+')" >> $GITHUB_ENV |
| 28 | + echo "RELEASE_TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV |
| 29 | + echo "IMAGE_REPO=$(echo ${GITHUB_REPOSITORY} | awk -F "/" '{print $1}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV |
| 30 | + echo "GH_ORG_NAME=${GITHUB_REPOSITORY%%/*}" >> $GITHUB_ENV |
| 31 | + - name: Setup Go |
| 32 | + uses: actions/setup-go@v5 |
| 33 | + with: |
| 34 | + go-version: '~1.22' |
| 35 | + - name: Set up QEMU |
| 36 | + uses: docker/setup-qemu-action@v3 |
| 37 | + - name: Set up Docker Buildx |
| 38 | + uses: docker/setup-buildx-action@v3 |
| 39 | + - name: Log into registry ghcr.io |
| 40 | + uses: docker/login-action@v3 |
| 41 | + with: |
| 42 | + registry: ghcr.io |
| 43 | + username: ${{ github.actor }} |
| 44 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + - name: Build and push |
| 46 | + run: | |
| 47 | + echo "Release tag is: $RELEASE_TAG" |
| 48 | + make docker-buildx |
| 49 | + - name: Run release |
| 50 | + run: | |
| 51 | + echo "Version is: $VERSION" |
| 52 | + echo "Previous version is: $PREVIOUS_VERSION" |
| 53 | + echo "Release branch is: $RELEASE_BRANCH" |
| 54 | + echo "Release tag is: $RELEASE_TAG" |
| 55 | + make release |
| 56 | + env: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments