|
| 1 | +name: release-tag-version |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v1.*' |
| 7 | + - '!v1*-rc*' |
| 8 | + - '!v1*-dev' |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: false |
| 13 | + |
| 14 | +jobs: |
| 15 | + binary: |
| 16 | + runs-on: nscloud |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + # fetch all commits instead of only the last as some branches are long lived and could have many between versions |
| 20 | + # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 |
| 21 | + - run: git fetch --unshallow --quiet --tags --force |
| 22 | + - uses: actions/setup-go@v4 |
| 23 | + with: |
| 24 | + go-version: "~1.21" |
| 25 | + check-latest: true |
| 26 | + - uses: actions/setup-node@v3 |
| 27 | + with: |
| 28 | + node-version: 20 |
| 29 | + - run: make deps-frontend deps-backend |
| 30 | + # xgo build |
| 31 | + - run: make release |
| 32 | + env: |
| 33 | + TAGS: bindata sqlite sqlite_unlock_notify |
| 34 | + - name: import gpg key |
| 35 | + id: import_gpg |
| 36 | + uses: crazy-max/ghaction-import-gpg@v5 |
| 37 | + with: |
| 38 | + gpg_private_key: ${{ secrets.GPGSIGN_KEY }} |
| 39 | + passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }} |
| 40 | + - name: sign binaries |
| 41 | + run: | |
| 42 | + for f in dist/release/*; do |
| 43 | + echo '${{ secrets.GPGSIGN_PASSPHRASE }}' | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u ${{ steps.import_gpg.outputs.fingerprint }} --output "$f.asc" "$f" |
| 44 | + done |
| 45 | + # clean branch name to get the folder name in S3 |
| 46 | + - name: Get cleaned branch name |
| 47 | + id: clean_name |
| 48 | + run: | |
| 49 | + REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//') |
| 50 | + echo "Cleaned name is ${REF_NAME}" |
| 51 | + echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT" |
| 52 | + - name: configure aws |
| 53 | + uses: aws-actions/configure-aws-credentials@v4 |
| 54 | + with: |
| 55 | + aws-region: ${{ secrets.AWS_REGION }} |
| 56 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 57 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 58 | + - name: upload binaries to s3 |
| 59 | + run: | |
| 60 | + aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress |
| 61 | + - name: create github release |
| 62 | + run: | |
| 63 | + gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --draft --notes-from-tag dist/release/* |
| 64 | + env: |
| 65 | + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
| 66 | + docker-rootful: |
| 67 | + runs-on: ubuntu-latest |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v4 |
| 70 | + # fetch all commits instead of only the last as some branches are long lived and could have many between versions |
| 71 | + # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 |
| 72 | + - run: git fetch --unshallow --quiet --tags --force |
| 73 | + - uses: docker/setup-qemu-action@v2 |
| 74 | + - uses: docker/setup-buildx-action@v2 |
| 75 | + - uses: docker/metadata-action@v5 |
| 76 | + id: meta |
| 77 | + with: |
| 78 | + images: gitea/gitea |
| 79 | + # this will generate tags in the following format: |
| 80 | + # latest |
| 81 | + # 1 |
| 82 | + # 1.2 |
| 83 | + # 1.2.3 |
| 84 | + tags: | |
| 85 | + type=raw,value=latest |
| 86 | + type=semver,pattern={{major}} |
| 87 | + type=semver,pattern={{major}}.{{minor}} |
| 88 | + type=semver,pattern={{version}} |
| 89 | + - name: Login to Docker Hub |
| 90 | + uses: docker/login-action@v2 |
| 91 | + with: |
| 92 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 93 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 94 | + - name: build rootful docker image |
| 95 | + uses: docker/build-push-action@v4 |
| 96 | + with: |
| 97 | + context: . |
| 98 | + platforms: linux/amd64,linux/arm64 |
| 99 | + push: true |
| 100 | + tags: ${{ steps.meta.outputs.tags }} |
| 101 | + labels: ${{ steps.meta.outputs.labels }} |
| 102 | + docker-rootless: |
| 103 | + runs-on: ubuntu-latest |
| 104 | + steps: |
| 105 | + - uses: actions/checkout@v4 |
| 106 | + # fetch all commits instead of only the last as some branches are long lived and could have many between versions |
| 107 | + # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 |
| 108 | + - run: git fetch --unshallow --quiet --tags --force |
| 109 | + - uses: docker/setup-qemu-action@v2 |
| 110 | + - uses: docker/setup-buildx-action@v2 |
| 111 | + - uses: docker/metadata-action@v5 |
| 112 | + id: meta |
| 113 | + with: |
| 114 | + images: gitea/gitea |
| 115 | + # each tag below will have the suffix of -rootless |
| 116 | + flavor: | |
| 117 | + suffix=-rootless |
| 118 | + # this will generate tags in the following format (with -rootless suffix added): |
| 119 | + # latest |
| 120 | + # 1 |
| 121 | + # 1.2 |
| 122 | + # 1.2.3 |
| 123 | + tags: | |
| 124 | + type=raw,value=latest |
| 125 | + type=semver,pattern={{major}} |
| 126 | + type=semver,pattern={{major}}.{{minor}} |
| 127 | + type=semver,pattern={{version}} |
| 128 | + - name: Login to Docker Hub |
| 129 | + uses: docker/login-action@v2 |
| 130 | + with: |
| 131 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 132 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 133 | + - name: build rootless docker image |
| 134 | + uses: docker/build-push-action@v4 |
| 135 | + with: |
| 136 | + context: . |
| 137 | + platforms: linux/amd64,linux/arm64 |
| 138 | + push: true |
| 139 | + file: Dockerfile.rootless |
| 140 | + tags: ${{ steps.meta.outputs.tags }} |
| 141 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments