code.gitea.io/gitea@v1.21.7/.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@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\/v//' -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: Install GH CLI
    62          uses: dev-hanz-ops/install-gh-cli-action@v0.1.0
    63          with:
    64            gh-cli-version: 2.39.1
    65        - name: create github release
    66          run: |
    67            gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-from-tag dist/release/*
    68          env:
    69            GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
    70    docker-rootful:
    71      runs-on: ubuntu-latest
    72      steps:
    73        - uses: actions/checkout@v4
    74        # fetch all commits instead of only the last as some branches are long lived and could have many between versions
    75        # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
    76        - run: git fetch --unshallow --quiet --tags --force
    77        - uses: docker/setup-qemu-action@v2
    78        - uses: docker/setup-buildx-action@v2
    79        - uses: docker/metadata-action@v5
    80          id: meta
    81          with:
    82            images: gitea/gitea
    83            # this will generate tags in the following format:
    84            # latest
    85            # 1
    86            # 1.2
    87            # 1.2.3
    88            tags: |
    89              type=semver,pattern={{major}}
    90              type=semver,pattern={{major}}.{{minor}}
    91              type=semver,pattern={{version}}
    92        - name: Login to Docker Hub
    93          uses: docker/login-action@v2
    94          with:
    95            username: ${{ secrets.DOCKERHUB_USERNAME }}
    96            password: ${{ secrets.DOCKERHUB_TOKEN }}
    97        - name: build rootful docker image
    98          uses: docker/build-push-action@v4
    99          with:
   100            context: .
   101            platforms: linux/amd64,linux/arm64
   102            push: true
   103            tags: ${{ steps.meta.outputs.tags }}
   104            labels: ${{ steps.meta.outputs.labels }}
   105    docker-rootless:
   106      runs-on: ubuntu-latest
   107      steps:
   108        - uses: actions/checkout@v4
   109        # fetch all commits instead of only the last as some branches are long lived and could have many between versions
   110        # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
   111        - run: git fetch --unshallow --quiet --tags --force
   112        - uses: docker/setup-qemu-action@v2
   113        - uses: docker/setup-buildx-action@v2
   114        - uses: docker/metadata-action@v5
   115          id: meta
   116          with:
   117            images: gitea/gitea
   118            # each tag below will have the suffix of -rootless
   119            flavor: |
   120              suffix=-rootless,onlatest=true
   121            # this will generate tags in the following format (with -rootless suffix added):
   122            # latest
   123            # 1
   124            # 1.2
   125            # 1.2.3
   126            tags: |
   127              type=semver,pattern={{major}}
   128              type=semver,pattern={{major}}.{{minor}}
   129              type=semver,pattern={{version}}
   130        - name: Login to Docker Hub
   131          uses: docker/login-action@v2
   132          with:
   133            username: ${{ secrets.DOCKERHUB_USERNAME }}
   134            password: ${{ secrets.DOCKERHUB_TOKEN }}
   135        - name: build rootless docker image
   136          uses: docker/build-push-action@v4
   137          with:
   138            context: .
   139            platforms: linux/amd64,linux/arm64
   140            push: true
   141            file: Dockerfile.rootless
   142            tags: ${{ steps.meta.outputs.tags }}
   143            labels: ${{ steps.meta.outputs.labels }}