code.gitea.io/gitea@v1.22.3/.github/workflows/release-tag-version.yml (about)

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