Skip to content

Commit

Permalink
ci👷(build): publish CI artifact to gitee
Browse files Browse the repository at this point in the history
  • Loading branch information
wendavid552 committed Sep 23, 2024
1 parent 5bdfa67 commit 4c61353
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
type: boolean
required: false
default: false
ci_release:
type: boolean
required: false
default: false
target_subproject:
description: see release.yml, leave it empty to build all
type: string
Expand All @@ -29,6 +33,21 @@ jobs:
distribution: 'temurin'
java-version: 21

- name: Get git info
id: get_git_info
run: |
short_sha=$(echo ${GITHUB_SHA} | cut -c1-7)
commit_count=$(git log | grep -e '^commit [a-zA-Z0-9]*' | wc -l)
echo "short_sha=$short_sha" >> $GITHUB_OUTPUT
echo "commit_count=$commit_count" >> $GITHUB_OUTPUT
- name: Read common properties
id: properties_g
uses: christian-draeger/[email protected]
with:
path: gradle.properties
properties: 'mod_name mod_version'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

Expand Down Expand Up @@ -61,6 +80,32 @@ jobs:
name: build-artifacts
path: versions/*/build/libs/

- name: Upload gitee CI artifacts
uses: nicennnnnnnlee/[email protected]
if: ${{ inputs.ci_release }}
with:
gitee_owner: wendavid552
gitee_repo: Carpet-AMS-Addition
gitee_token: ${{ secrets.GITEE_API_TOKEN }}
gitee_tag_name: ${{ format('{0}.{1}', github.ref_name, steps.get_git_info.outputs.commit_count) }}
gitee_release_name: ${{ format('[CI#{0}]{1} {2}.{3}+{4}', github.run_number, steps.properties_g.outputs.mod_name, steps.properties_g.outputs.mod_version, steps.get_git_info.outputs.commit_count, steps.get_git_info.outputs.short_sha) }}
gitee_release_body: |-
**This version is automatically released by CI Build**
Latest commit log:
${{ github.event.head_commit.message }}
-------
Build Information
- Built from: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
gitee_target_commitish: ${{ github.sha }}
gitee_upload_retry_times: 3
gitee_files: |
build-artifacts/*/build/libs/!(*-@(dev|sources|shadow)).jar
summary:
runs-on: ubuntu-22.04
needs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ jobs:
uses: ./.github/workflows/build.yml
with:
mixin_audit: true
ci_release: ${{ github.event_name == 'push' && github.ref_name != 'master' }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:
modrinth-token: ${{ secrets.MODRINTH_API_TOKEN }}

curseforge-id: 1002635
curseforge-token: ${{ secrets.CF_API_TOKEN }}
curseforge-token: ${{ secrets.CURSEFORGE_API_TOKEN }}

github-tag: ${{ steps.release_info.outputs.tag_name }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 4c61353

Please sign in to comment.