Gitea 1.23.1
This commit is contained in:
		| @@ -11,54 +11,83 @@ on: | |||||||
|         description: "Did the flow succeed?" |         description: "Did the flow succeed?" | ||||||
|         value: ${{ jobs.publish.outputs.success }} |         value: ${{ jobs.publish.outputs.success }} | ||||||
|  |  | ||||||
| env: |  | ||||||
|   REGISTRY_URL: git.tainton.uk |  | ||||||
|  |  | ||||||
| jobs: | jobs: | ||||||
|   publish: |   publish: | ||||||
|     runs-on: ubuntu-latest |     name: Publish Docker Images | ||||||
|     # permissions: |     needs: create_release | ||||||
|     #   packages: write |  | ||||||
|     #   contents: read |  | ||||||
|     #   attestations: write |  | ||||||
|     #   id-token: write |  | ||||||
|     outputs: |  | ||||||
|       success: ${{ steps.set_flag.outputs.success }} |  | ||||||
|     steps: |     steps: | ||||||
|       - name: Check out repository code |       - name: Update Docker configuration | ||||||
|         uses: actions/checkout@v4.1.7 |         continue-on-error: true | ||||||
|  |         run: | | ||||||
|  |           mkdir -p /etc/default | ||||||
|  |           mkdir -p /etc/docker | ||||||
|  |           touch -a /etc/default/docker | ||||||
|  |           touch -a /etc/docker/daemon.json | ||||||
|  |           echo "DOCKER_OPTS=\"--insecure-registry ${{ vars.PACKAGES_REGISTRY_URL }}\"" >> /etc/default/docker | ||||||
|  |           echo "{\"insecure-registries\": [\"${{ vars.PACKAGES_REGISTRY_URL }}\"]}" > /etc/docker/daemon.json | ||||||
|  |  | ||||||
|  |       - name: Get repo name | ||||||
|  |         env: | ||||||
|  |           REPO: ${{ gitea.repository }} | ||||||
|  |         id: split | ||||||
|  |         run: echo "repo=${REPO##*/}" >> $GITEA_OUTPUT | ||||||
|  |  | ||||||
|  |       - name: Check out repository | ||||||
|  |         uses: actions/checkout@v4.2.2 | ||||||
|         with: |         with: | ||||||
|  |           fetch-depth: 0 | ||||||
|           ref: ${{ inputs.release }} |           ref: ${{ inputs.release }} | ||||||
|  |  | ||||||
|       - name: Set up Docker Buildx |       - name: Set up Docker Buildx | ||||||
|         uses: docker/setup-buildx-action@v3 |         uses: docker/setup-buildx-action@v3 | ||||||
|  |  | ||||||
|       - name: Log in to Gitea Package Registry |       - name: Log in to Gitea Container Registry | ||||||
|         uses: docker/login-action@v3 |         uses: docker/login-action@v3 | ||||||
|         with: |         with: | ||||||
|           registry: ${{ env.REGISTRY_URL }} |           registry: ${{ vars.PACKAGES_REGISTRY_URL }} | ||||||
|           username: ${{ gitea.actor }} |           username: ${{ vars.ACTIONS_USERNAME }} | ||||||
|           password: ${{ secrets.GITEA_TOKEN }} |           password: ${{ secrets.ACTIONS_TOKEN }} | ||||||
|  |  | ||||||
|  |       - name: Log in to GitHub Container Registry | ||||||
|  |         uses: docker/login-action@v3 | ||||||
|  |         with: | ||||||
|  |           registry: ghcr.io | ||||||
|  |           username: ${{ vars.GHCR_USERNAME }} | ||||||
|  |           password: ${{ secrets.GHCR_TOKEN }} | ||||||
|  |  | ||||||
|       - name: Extract metadata (tags, labels) for Docker |       - name: Extract metadata (tags, labels) for Docker | ||||||
|         id: meta |         id: meta | ||||||
|         uses: docker/metadata-action@v5 |         uses: docker/metadata-action@v5 | ||||||
|         with: |         with: | ||||||
|           images: | |           images: | | ||||||
|             ${{ env.REGISTRY_URL }}/${{ gitea.repository }} |             ghcr.io/${{ vars.GHCR_USERNAME }}/${{ steps.split.outputs.repo }} | ||||||
|           tags: | |             ${{ vars.PACKAGES_REGISTRY_URL }}/${{ gitea.repository }} | ||||||
|             type=semver,pattern=v{{version}},value=${{ inputs.release }} |           tags: type=semver,pattern=v{{version}},value=${{ inputs.release }} | ||||||
|  |  | ||||||
|       - name: Build and push Docker image |       - name: Print metadata | ||||||
|         id: push |         run: | | ||||||
|  |           printf "Annotations:\n${{ steps.meta.outputs.annotations }}" | ||||||
|  |           echo "" | ||||||
|  |           printf "Labels:\n${{ steps.meta.outputs.labels }}" | ||||||
|  |           echo "" | ||||||
|  |           printf "Tags:\n${{ steps.meta.outputs.tags }}" | ||||||
|  |  | ||||||
|  |       - name: Build images | ||||||
|         uses: docker/build-push-action@v6 |         uses: docker/build-push-action@v6 | ||||||
|         with: |         with: | ||||||
|           context: . |           context: . | ||||||
|           push: true |           push: false | ||||||
|  |           load: true | ||||||
|  |           annotations: ${{ steps.meta.outputs.annotations }} | ||||||
|           labels: ${{ steps.meta.outputs.labels }} |           labels: ${{ steps.meta.outputs.labels }} | ||||||
|           tags: | |           tags: ${{ steps.meta.outputs.tags }} | ||||||
|             ${{ env.REGISTRY_URL }}/${{ gitea.repository }}:latest |  | ||||||
|             ${{ env.REGISTRY_URL }}/${{ gitea.repository }}:${{ inputs.release }} |       - name: Push images | ||||||
|  |         run: | | ||||||
|  |           strtags="${{ steps.meta.outputs.tags }}" | ||||||
|  |           readarray -t lines <<<"$strtags" | ||||||
|  |           for element in "${lines[@]}"; do docker push "$element"; done | ||||||
|  |           unset strtags lines | ||||||
|        |        | ||||||
|       - name: Set success flag |       - name: Set success flag | ||||||
|         id: set_flag |         id: set_flag | ||||||
|   | |||||||
| @@ -17,34 +17,83 @@ jobs: | |||||||
|       release_name: ${{ steps.tag_version.outputs.new_tag }} |       release_name: ${{ steps.tag_version.outputs.new_tag }} | ||||||
|       success: ${{ steps.set_flag.outputs.success }} |       success: ${{ steps.set_flag.outputs.success }} | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4.2.2 | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 0 |           fetch-depth: 0 | ||||||
|  |  | ||||||
|       - name: Changes since last tag |       - name: Changes since last tag | ||||||
|         id: changes |         id: changes | ||||||
|         run: | |         run: | | ||||||
|           CHANGES=$(git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline) |           rm -f .changes .changes_feat .changes_fix .changes_dep .changes_other | ||||||
|           echo "$CHANGES" |           git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline >> .changes | ||||||
|           if [ -z "$CHANGES" ]; then echo "changes=false" >> "$GITEA_OUTPUT"; else echo "changes=true" >> "$GITEA_OUTPUT"; fi |           cat .changes | ||||||
|  |           if [[ -z $(grep '[^[:space:]]' .changes) ]] ; then | ||||||
|  |             echo "changes=false" | ||||||
|  |             echo "changes=false" >> "$GITEA_OUTPUT" | ||||||
|  |           else | ||||||
|  |             echo "changes=true" | ||||||
|  |             echo "changes=true" >> "$GITEA_OUTPUT" | ||||||
|  |             grep -i "feat" .changes >> .changes_feat | ||||||
|  |             grep -i "fix" .changes >> .changes_fix | ||||||
|  |             grep -i "dependencies" .changes >> .changes_dep | ||||||
|  |             grep -i "other" .changes >> .changes_other | ||||||
|  |           fi           | ||||||
|  |  | ||||||
|       - name: Bump version and push tag |       - name: Cancel if no changes | ||||||
|         id: tag_version |         if: steps.changes.outputs.changes == 'false' | ||||||
|         if: steps.changes.outputs.changes == 'true' |         run: exit 1 | ||||||
|         uses: mathieudutour/github-tag-action@v6.2 |  | ||||||
|         with: |  | ||||||
|           github_token: ${{ secrets.GITHUB_TOKEN }} |  | ||||||
|           default_bump: minor |  | ||||||
|           # default_bump: false |  | ||||||
|  |  | ||||||
|       - name: Create a GitHub release |       - name: Create changelog | ||||||
|  |         id: create_changelog | ||||||
|         if: steps.changes.outputs.changes == 'true' |         if: steps.changes.outputs.changes == 'true' | ||||||
|         uses: ncipollo/release-action@v1 |         run: | | ||||||
|  |           rm -f .changelog | ||||||
|  |           if [[ -z $(grep '[^[:space:]]' .changes_feat) ]] ; then | ||||||
|  |             printf "## 🚀 Features" > .changelog | ||||||
|  |             cat .changes_feat >> .changelog | ||||||
|  |           fi | ||||||
|  |           if [[ -z $(grep '[^[:space:]]' .changes_fix) ]] ; then | ||||||
|  |             printf "## 🐛 Bug Fixes" >> .changelog | ||||||
|  |             cat .changes_fix >> .changelog | ||||||
|  |           fi | ||||||
|  |           if [[ -z $(grep '[^[:space:]]' .changes_dep) ]] ; then | ||||||
|  |             printf "## 📦 Dependencies" >> .changelog | ||||||
|  |             cat .changes_dep >> .changelog | ||||||
|  |           fi | ||||||
|  |           if [[ -z $(grep '[^[:space:]]' .changes_other) ]] ; then | ||||||
|  |             printf "## 💬 Other" >> .changelog | ||||||
|  |             cat .changes_other >> .changelog | ||||||
|  |           fi           | ||||||
|  |  | ||||||
|  |       - name: Set server URL | ||||||
|  |         id: set_srvurl | ||||||
|  |         run: | | ||||||
|  |           SRVURL=$(echo "${{ gitea.server_url }}" | sed 's/https:\/\/\(.*\)/\1/') | ||||||
|  |           echo "srvurl=$SRVURL" >> "$GITEA_OUTPUT"           | ||||||
|  |  | ||||||
|  |       - name: Get next version | ||||||
|  |         uses: TriPSs/conventional-changelog-action@v6 | ||||||
|  |         id: get_next_version | ||||||
|         with: |         with: | ||||||
|           tag: ${{ steps.tag_version.outputs.new_tag }} |           git-url: ${{ steps.set_srvurl.outputs.srvurl }} | ||||||
|           name: ${{ steps.tag_version.outputs.new_tag }} |           github-token: ${{ gitea.token }} | ||||||
|           body: ${{ steps.tag_version.outputs.changelog }} |           skip-commit: true | ||||||
|           generateReleaseNotes: true |           release-count: 1 | ||||||
|  |           output-file: false | ||||||
|  |           create-summary: true | ||||||
|  |           skip-on-empty: true | ||||||
|  |           skip-version-file: true | ||||||
|  |           skip-tag: true | ||||||
|  |  | ||||||
|  |       - name: Create release | ||||||
|  |         id: create_release | ||||||
|  |         uses: akkuman/gitea-release-action@v1 | ||||||
|  |         env: | ||||||
|  |           NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18 | ||||||
|  |         with: | ||||||
|  |           tag: ${{ steps.get_next_version.outputs.tag }} | ||||||
|  |           name: ${{ steps.get_next_version.outputs.tag }} | ||||||
|  |           body_path: .changelog | ||||||
|  |  | ||||||
|       - name: Set success/fail flag |       - name: Set success/fail flag | ||||||
|         id: set_flag |         id: set_flag | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| name: Create Release | name: Release | ||||||
| on: | on: | ||||||
|   workflow_call: |   workflow_call: | ||||||
|     outputs: |     outputs: | ||||||
| @@ -13,58 +13,36 @@ jobs: | |||||||
|   create_release: |   create_release: | ||||||
|     name: Create Release |     name: Create Release | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|  |     # needs: test | ||||||
|     outputs: |     outputs: | ||||||
|       release_name: ${{ steps.tag_version.outputs.new_tag }} |       release_name: ${{ steps.get_next_version.outputs.tag }} | ||||||
|       success: ${{ steps.set_flag.outputs.success }} |  | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4.2.2 |       - name: Check out repository | ||||||
|  |         uses: actions/checkout@v4.2.2 | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 0 |           fetch-depth: 0 | ||||||
|  |  | ||||||
|       - name: Changes since last tag |       - name: Changes since last tag | ||||||
|         id: changes |         id: changes | ||||||
|         run: | |         run: | | ||||||
|           rm -f .changes .changes_feat .changes_fix .changes_dep .changes_other |           rm -f .changes | ||||||
|           git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline >> .changes |           git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline >> .changes | ||||||
|           cat .changes |           cat .changes | ||||||
|  |  | ||||||
|  |       - name: Check for changes | ||||||
|  |         run: | | ||||||
|           if [[ -z $(grep '[^[:space:]]' .changes) ]] ; then |           if [[ -z $(grep '[^[:space:]]' .changes) ]] ; then | ||||||
|             echo "changes=false" |             echo "changes=false" | ||||||
|             echo "changes=false" >> "$GITEA_OUTPUT" |             echo "changes=false" >> "$GITEA_OUTPUT" | ||||||
|           else |           else | ||||||
|             echo "changes=true" |             echo "changes=true" | ||||||
|             echo "changes=true" >> "$GITEA_OUTPUT" |             echo "changes=true" >> "$GITEA_OUTPUT" | ||||||
|             grep -i "feat" .changes >> .changes_feat |  | ||||||
|             grep -i "fix" .changes >> .changes_fix |  | ||||||
|             grep -i "dependencies" .changes >> .changes_dep |  | ||||||
|             grep -i "other" .changes >> .changes_other |  | ||||||
|           fi |           fi | ||||||
|  |  | ||||||
|       - name: Cancel if no changes |       - name: Cancel if no changes | ||||||
|         if: steps.changes.outputs.changes == 'false' |         if: steps.changes.outputs.changes == 'false' | ||||||
|         run: exit 1 |         run: exit 1 | ||||||
|  |  | ||||||
|       - name: Create changelog |  | ||||||
|         id: create_changelog |  | ||||||
|         if: steps.changes.outputs.changes == 'true' |  | ||||||
|         run: | |  | ||||||
|           rm -f .changelog |  | ||||||
|           if [[ -z $(grep '[^[:space:]]' .changes_feat) ]] ; then |  | ||||||
|             printf "## 🚀 Features" > .changelog |  | ||||||
|             cat .changes_feat >> .changelog |  | ||||||
|           fi |  | ||||||
|           if [[ -z $(grep '[^[:space:]]' .changes_fix) ]] ; then |  | ||||||
|             printf "## 🐛 Bug Fixes" >> .changelog |  | ||||||
|             cat .changes_fix >> .changelog |  | ||||||
|           fi |  | ||||||
|           if [[ -z $(grep '[^[:space:]]' .changes_dep) ]] ; then |  | ||||||
|             printf "## 📦 Dependencies" >> .changelog |  | ||||||
|             cat .changes_dep >> .changelog |  | ||||||
|           fi |  | ||||||
|           if [[ -z $(grep '[^[:space:]]' .changes_other) ]] ; then |  | ||||||
|             printf "## 💬 Other" >> .changelog |  | ||||||
|             cat .changes_other >> .changelog |  | ||||||
|           fi           |  | ||||||
|  |  | ||||||
|       - name: Set server URL |       - name: Set server URL | ||||||
|         id: set_srvurl |         id: set_srvurl | ||||||
|         run: | |         run: | | ||||||
| @@ -77,6 +55,8 @@ jobs: | |||||||
|         with: |         with: | ||||||
|           git-url: ${{ steps.set_srvurl.outputs.srvurl }} |           git-url: ${{ steps.set_srvurl.outputs.srvurl }} | ||||||
|           github-token: ${{ gitea.token }} |           github-token: ${{ gitea.token }} | ||||||
|  |           preset: "conventionalcommits" | ||||||
|  |           # preset: "angular"  # This is the default | ||||||
|           skip-commit: true |           skip-commit: true | ||||||
|           release-count: 1 |           release-count: 1 | ||||||
|           output-file: false |           output-file: false | ||||||
| @@ -86,16 +66,10 @@ jobs: | |||||||
|           skip-tag: true |           skip-tag: true | ||||||
|  |  | ||||||
|       - name: Create release |       - name: Create release | ||||||
|         id: create_release |         run: | | ||||||
|         uses: akkuman/gitea-release-action@v1 |           curl -s -X POST \ | ||||||
|         env: |             -H "Authorization: token ${{ secrets.ACTIONS_TOKEN }}" \ | ||||||
|           NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18 |             -H "accept: application/json" \ | ||||||
|         with: |             -H "Content-Type: application/json" \ | ||||||
|           tag: ${{ steps.get_next_version.outputs.tag }} |             -d "{\"tag_name\": \"${{ steps.get_next_version.outputs.tag }}\", \"name\": \"${{ steps.get_next_version.outputs.tag }}\", \"body\": \"${{ steps.get_next_version.outputs.changelog }}\"}" \ | ||||||
|           name: ${{ steps.get_next_version.outputs.tag }} |             "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" | ||||||
|           body_path: .changelog |  | ||||||
|  |  | ||||||
|       - name: Set success/fail flag |  | ||||||
|         id: set_flag |  | ||||||
|         if: steps.changes.outputs.changes == 'true' |  | ||||||
|         run: if test "${{ steps.changes.outputs.changes }}" = "true"; then echo "success=true" >> "$GITEA_OUTPUT"; else echo "success=false" >> "$GITEA_OUTPUT"; fi |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user