name:"CodeQL" on: push: branches: [main, release-3.4, release-3.5, release-3.6] pull_request: # The branches below must be a subset of the branches above branches: [main] schedule:# 定时任务 -cron:'20 14 * * 5' permissions:read-all jobs: analyze: name:Analyze runs-on:ubuntu-latest permissions: actions:read contents:read security-events:write strategy:# 具体参考https://docs.github.com/zh/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategy fail-fast:false matrix: # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed language: ['go'] steps: -name:Checkoutrepository uses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2 # Initializes the CodeQL tools for scanning. -name:InitializeCodeQL uses:github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c# v3.28.1 with: # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. # queries: ./path/to/local/query, your-org/your-repo/queries@main languages:${{matrix.language}} # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) -name:Autobuild uses:github/codeql-action/autobuild@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c# v3.28.1 -name:PerformCodeQLAnalysis uses:github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c# v3.28.1
--- name:Scorecardssupply-chainsecurity on: # Only the default branch is supported. branch_protection_rule: schedule: -cron:'45 1 * * 0' push: branches: ["main"]
# Declare default permissions as read only. permissions:read-all
jobs: analysis: name:Scorecardsanalysis runs-on:ubuntu-latest permissions: # Needed to upload the results to code-scanning dashboard. security-events:write # Used to receive a badge. id-token:write
# Publish the results for public repositories to enable scorecard badges. For more details, see # https://github.com/ossf/scorecard-action#publishing-results. # For private repositories, `publish_results` will automatically be set to `false`, regardless # of the value entered here. publish_results:true
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. -name:"Upload artifact" uses:actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08# v4.6.0 with: name:SARIFfile path:results.sarif retention-days:5
# Upload the results to GitHub's code scanning dashboard. -name:"Upload to code-scanning" uses:github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c# v3.28.1 with: sarif_file:results.sarif
backend: if:needs.files-changed.outputs.backend=='true'||needs.files-changed.outputs.actions=='true' needs:files-changed runs-on:ubuntu-latest steps: -uses:actions/checkout@v4 -uses:actions/setup-go@v5 with: go-version-file:go.mod check-latest:true # no frontend build here as backend should be able to build # even without any frontend files -run:makedeps-backend -run:gobuild-ogitea_no_gcc# test if build succeeds without the sqlite tag -name:build-backend-arm64 run:makebackend# test cross compile env: GOOS:linux GOARCH:arm64 TAGS:bindatagogit -name:build-backend-windows run:gobuild-ogitea_windows env: GOOS:windows GOARCH:amd64 TAGS:bindatagogit -name:build-backend-386 run:gobuild-ogitea_linux_386# test if compatible with 32 bit env: GOOS:linux GOARCH:386
jobs: binary: runs-on:namespace-profile-gitea-release-binary steps: -uses:actions/checkout@v4 # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 -run:gitfetch--unshallow--quiet--tags--force -uses:actions/setup-go@v5 with: go-version-file:go.mod check-latest:true -uses:actions/setup-node@v4 with: node-version:22 cache:npm cache-dependency-path:package-lock.json -run:makedeps-frontenddeps-backend # xgo build -run:makerelease env: TAGS:bindatasqlitesqlite_unlock_notify -name:importgpgkey id:import_gpg uses:crazy-max/ghaction-import-gpg@v6 with: gpg_private_key:${{secrets.GPGSIGN_KEY}} passphrase:${{secrets.GPGSIGN_PASSPHRASE}} -name:signbinaries run:| for f in dist/release/*; do 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" done # clean branch name to get the folder name in S3 -name:Getcleanedbranchname id:clean_name run:| REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//') echo "Cleaned name is ${REF_NAME}" echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT" -name:configureaws uses:aws-actions/configure-aws-credentials@v4 with: aws-region:${{secrets.AWS_REGION}} aws-access-key-id:${{secrets.AWS_ACCESS_KEY_ID}} aws-secret-access-key:${{secrets.AWS_SECRET_ACCESS_KEY}} -name:uploadbinariestos3 run:| aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress -name:InstallGHCLI uses:dev-hanz-ops/install-gh-cli-action@v0.1.0 with: gh-cli-version:2.39.1 -name:creategithubrelease run:| gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-from-tag dist/release/* env: GITHUB_TOKEN:${{secrets.RELEASE_TOKEN}} docker-rootful: runs-on:namespace-profile-gitea-release-docker steps: -uses:actions/checkout@v4 # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 -run:gitfetch--unshallow--quiet--tags--force -uses:docker/setup-qemu-action@v3 -uses:docker/setup-buildx-action@v3 -uses:docker/metadata-action@v5 id:meta with: images:gitea/gitea # this will generate tags in the following format: # latest # 1 # 1.2 # 1.2.3 tags:| type=semver,pattern={{major}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{version}} -name:LogintoDockerHub uses:docker/login-action@v3 with: username:${{secrets.DOCKERHUB_USERNAME}} password:${{secrets.DOCKERHUB_TOKEN}} -name:buildrootfuldockerimage uses:docker/build-push-action@v5 with: context:. platforms:linux/amd64,linux/arm64 push:true tags:${{steps.meta.outputs.tags}} labels:${{steps.meta.outputs.labels}} docker-rootless: runs-on:namespace-profile-gitea-release-docker steps: -uses:actions/checkout@v4 # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 -run:gitfetch--unshallow--quiet--tags--force -uses:docker/setup-qemu-action@v3 -uses:docker/setup-buildx-action@v3 -uses:docker/metadata-action@v5 id:meta with: images:gitea/gitea # each tag below will have the suffix of -rootless flavor:| suffix=-rootless,onlatest=true # this will generate tags in the following format (with -rootless suffix added): # latest # 1 # 1.2 # 1.2.3 tags:| type=semver,pattern={{major}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{version}} -name:LogintoDockerHub uses:docker/login-action@v3 with: username:${{secrets.DOCKERHUB_USERNAME}} password:${{secrets.DOCKERHUB_TOKEN}} -name:buildrootlessdockerimage uses:docker/build-push-action@v5 with: context:. platforms:linux/amd64,linux/arm64 push:true file:Dockerfile.rootless tags:${{steps.meta.outputs.tags}} labels:${{steps.meta.outputs.labels}}
jobs: binary: runs-on:namespace-profile-gitea-release-binary steps: -uses:actions/checkout@v4 # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 -run:gitfetch--unshallow--quiet--tags--force -uses:actions/setup-go@v5 with: go-version-file:go.mod check-latest:true -uses:actions/setup-node@v4 with: node-version:22 cache:npm cache-dependency-path:package-lock.json -run:makedeps-frontenddeps-backend # xgo build -run:makerelease env: TAGS:bindatasqlitesqlite_unlock_notify -name:importgpgkey id:import_gpg uses:crazy-max/ghaction-import-gpg@v6 with: gpg_private_key:${{secrets.GPGSIGN_KEY}} passphrase:${{secrets.GPGSIGN_PASSPHRASE}} -name:signbinaries run:| for f in dist/release/*; do 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" done # clean branch name to get the folder name in S3 -name:Getcleanedbranchname id:clean_name run:| REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//') echo "Cleaned name is ${REF_NAME}" echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT" -name:configureaws uses:aws-actions/configure-aws-credentials@v4 with: aws-region:${{secrets.AWS_REGION}} aws-access-key-id:${{secrets.AWS_ACCESS_KEY_ID}} aws-secret-access-key:${{secrets.AWS_SECRET_ACCESS_KEY}} -name:uploadbinariestos3 run:| aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress -name:InstallGHCLI uses:dev-hanz-ops/install-gh-cli-action@v0.1.0 with: gh-cli-version:2.39.1 -name:creategithubrelease run:| gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --draft --notes-from-tag dist/release/* env: GITHUB_TOKEN:${{secrets.RELEASE_TOKEN}} docker-rootful: runs-on:namespace-profile-gitea-release-docker steps: -uses:actions/checkout@v4 # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 -run:gitfetch--unshallow--quiet--tags--force -uses:docker/setup-qemu-action@v3 -uses:docker/setup-buildx-action@v3 -uses:docker/metadata-action@v5 id:meta with: images:gitea/gitea flavor:| latest=false # 1.2.3-rc0 tags:| type=semver,pattern={{version}} -name:LogintoDockerHub uses:docker/login-action@v3 with: username:${{secrets.DOCKERHUB_USERNAME}} password:${{secrets.DOCKERHUB_TOKEN}} -name:buildrootfuldockerimage uses:docker/build-push-action@v5 with: context:. platforms:linux/amd64,linux/arm64 push:true tags:${{steps.meta.outputs.tags}} labels:${{steps.meta.outputs.labels}} docker-rootless: runs-on:namespace-profile-gitea-release-docker steps: -uses:actions/checkout@v4 # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 -run:gitfetch--unshallow--quiet--tags--force -uses:docker/setup-qemu-action@v3 -uses:docker/setup-buildx-action@v3 -uses:docker/metadata-action@v5 id:meta with: images:gitea/gitea # each tag below will have the suffix of -rootless flavor:| latest=false suffix=-rootless # 1.2.3-rc0 tags:| type=semver,pattern={{version}} -name:LogintoDockerHub uses:docker/login-action@v3 with: username:${{secrets.DOCKERHUB_USERNAME}} password:${{secrets.DOCKERHUB_TOKEN}} -name:buildrootlessdockerimage uses:docker/build-push-action@v5 with: context:. platforms:linux/amd64,linux/arm64 push:true file:Dockerfile.rootless tags:${{steps.meta.outputs.tags}} labels:${{steps.meta.outputs.labels}}
jobs: binary: runs-on:namespace-profile-gitea-release-binary steps: -uses:actions/checkout@v4 # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 -run:gitfetch--unshallow--quiet--tags--force -uses:actions/setup-go@v5 with: go-version-file:go.mod check-latest:true -uses:actions/setup-node@v4 with: node-version:22 cache:npm cache-dependency-path:package-lock.json -run:makedeps-frontenddeps-backend # xgo build -run:makerelease env: TAGS:bindatasqlitesqlite_unlock_notify -name:importgpgkey id:import_gpg uses:crazy-max/ghaction-import-gpg@v6 with: gpg_private_key:${{secrets.GPGSIGN_KEY}} passphrase:${{secrets.GPGSIGN_PASSPHRASE}} -name:signbinaries run:| for f in dist/release/*; do 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" done # clean branch name to get the folder name in S3 -name:Getcleanedbranchname id:clean_name run:| REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//') echo "Cleaned name is ${REF_NAME}" echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT" -name:configureaws uses:aws-actions/configure-aws-credentials@v4 with: aws-region:${{secrets.AWS_REGION}} aws-access-key-id:${{secrets.AWS_ACCESS_KEY_ID}} aws-secret-access-key:${{secrets.AWS_SECRET_ACCESS_KEY}} -name:uploadbinariestos3 run:| aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress -name:InstallGHCLI uses:dev-hanz-ops/install-gh-cli-action@v0.1.0 with: gh-cli-version:2.39.1 -name:creategithubrelease run:| gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-from-tag dist/release/* env: GITHUB_TOKEN:${{secrets.RELEASE_TOKEN}} docker-rootful: runs-on:namespace-profile-gitea-release-docker steps: -uses:actions/checkout@v4 # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 -run:gitfetch--unshallow--quiet--tags--force -uses:docker/setup-qemu-action@v3 -uses:docker/setup-buildx-action@v3 -uses:docker/metadata-action@v5 id:meta with: images:gitea/gitea # this will generate tags in the following format: # latest # 1 # 1.2 # 1.2.3 tags:| type=semver,pattern={{major}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{version}} -name:LogintoDockerHub uses:docker/login-action@v3 with: username:${{secrets.DOCKERHUB_USERNAME}} password:${{secrets.DOCKERHUB_TOKEN}} -name:buildrootfuldockerimage uses:docker/build-push-action@v5 with: context:. platforms:linux/amd64,linux/arm64 push:true tags:${{steps.meta.outputs.tags}} labels:${{steps.meta.outputs.labels}} docker-rootless: runs-on:namespace-profile-gitea-release-docker steps: -uses:actions/checkout@v4 # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 -run:gitfetch--unshallow--quiet--tags--force -uses:docker/setup-qemu-action@v3 -uses:docker/setup-buildx-action@v3 -uses:docker/metadata-action@v5 id:meta with: images:gitea/gitea # each tag below will have the suffix of -rootless flavor:| suffix=-rootless,onlatest=true # this will generate tags in the following format (with -rootless suffix added): # latest # 1 # 1.2 # 1.2.3 tags:| type=semver,pattern={{major}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{version}} -name:LogintoDockerHub uses:docker/login-action@v3 with: username:${{secrets.DOCKERHUB_USERNAME}} password:${{secrets.DOCKERHUB_TOKEN}} -name:buildrootlessdockerimage uses:docker/build-push-action@v5 with: context:. platforms:linux/amd64,linux/arm64 push:true file:Dockerfile.rootless tags:${{steps.meta.outputs.tags}} labels:${{steps.meta.outputs.labels}}