|
18 | 18 | runs-on: ubuntu-latest
|
19 | 19 | container: devkitpro/devkitarm
|
20 | 20 | name: Build with Docker using devkitARM
|
21 |
| - outputs: |
22 |
| - commit_tag: ${{ steps.build.outputs.commit_tag }} |
23 |
| - commit_hash: ${{ steps.build.outputs.commit_hash }} |
24 |
| - author_name: ${{ steps.build.outputs.author_name }} |
25 |
| - committer_name: ${{ steps.build.outputs.committer_name }} |
26 |
| - commit_subject: ${{ steps.build.outputs.commit_subject }} |
27 |
| - commit_message: ${{ steps.build.outputs.commit_message }} |
28 | 21 | steps:
|
29 | 22 | - name: Checkout repo
|
30 | 23 | uses: actions/checkout@v3
|
|
38 | 31 | id: build
|
39 | 32 | run: |
|
40 | 33 | make
|
41 |
| -
|
42 |
| - echo ::set-output name=commit_tag::$(git describe --abbrev=0 --tags) |
43 |
| - echo ::set-output name=commit_hash::$(git log --format=%h -1) |
44 |
| -
|
45 |
| - # Webhook info |
46 |
| - echo "::set-output name=author_name::$(git log -1 $GITHUB_SHA --pretty=%aN)" |
47 |
| - echo "::set-output name=committer_name::$(git log -1 $GITHUB_SHA --pretty=%cN)" |
48 |
| - echo "::set-output name=commit_subject::$(git log -1 $GITHUB_SHA --pretty=%s)" |
49 |
| - echo "::set-output name=commit_message::$(git log -1 $GITHUB_SHA --pretty=%b)" |
50 | 34 | - name: Pack 7z for nightly
|
51 | 35 | if: ${{ !startsWith(github.ref, 'refs/tags') }}
|
52 | 36 | run: |
|
|
72 | 56 | name: Publish build to TWLBot/Builds
|
73 | 57 | if: ${{ success() && !startsWith(github.ref, 'refs/pull') }}
|
74 | 58 | needs: build
|
75 |
| - env: |
76 |
| - COMMIT_TAG: ${{ needs.build.outputs.commit_tag }} |
77 |
| - COMMIT_HASH: ${{ needs.build.outputs.commit_hash }} |
78 |
| - AUTHOR_NAME: ${{ needs.build.outputs.author_name }} |
79 |
| - COMMIT_SUBJECT: ${{ needs.build.outputs.commit_subject }} |
80 |
| - COMMIT_MESSAGE: ${{ needs.build.outputs.commit_message }} |
81 |
| - outputs: |
82 |
| - current_date: ${{ steps.commit.outputs.current_date }} |
83 | 59 | steps:
|
84 | 60 | - name: Download artifacts
|
85 | 61 | uses: actions/download-artifact@v3
|
|
99 | 75 |
|
100 | 76 | curl -XPOST -H "$AUTH_HEADER" -H "$CONTENT_LENGTH" -H "$CONTENT_TYPE" --upload-file "$file" "$UPLOAD_URL"
|
101 | 77 | done
|
102 |
| - - name: Commit and push to TWLBot/Builds |
103 |
| - if: ${{ !startsWith(github.ref, 'refs/tags') }} |
104 |
| - id: commit |
105 |
| - run: | |
106 |
| - CURRENT_DATE=$(date +"%Y%m%d-%H%M%S") |
107 |
| - echo ::set-output name=current_date::$CURRENT_DATE |
108 |
| -
|
109 |
| - git config --global user.email "flamekat54@aol.com" |
110 |
| - git config --global user.name "TWLBot" |
111 |
| - git clone --depth 1 https://${{ secrets.TWLBOT_TOKEN }}@github.com/TWLBot/Builds.git |
112 |
| - mkdir -p Builds/extras |
113 |
| - cd Builds/extras |
114 |
| - cp ${{ github.workspace }}/build/* . |
115 |
| - git stage . |
116 |
| - git commit -m "hiyaCFW | $COMMIT_HASH" |
117 |
| - git tag v$CURRENT_DATE |
118 |
| - git push origin master v$CURRENT_DATE |
119 |
| - - name: Release to TWLBot/Builds |
120 |
| - if: ${{ !startsWith(github.ref, 'refs/tags') }} |
121 |
| - run: | |
122 |
| - AUTH_HEADER="Authorization: token ${{ secrets.TWLBOT_TOKEN }}" |
123 |
| - CONTENT_TYPE="Content-Type: application/json" |
124 |
| - API_URL="https://api.github.com/repos/TWLBot/Builds/releases" |
125 |
| - RELEASE_INFO="{\"tag_name\": \"v${{ steps.commit.outputs.current_date }}\", \"name\": \"hiyaCFW | $COMMIT_HASH\", \"body\": \"$AUTHOR_NAME - $COMMIT_SUBJECT\\n\\n$COMMIT_MESSAGE\", \"prerelease\": true}" |
126 |
| -
|
127 |
| - RESPONSE=$(curl -XPOST -H "$AUTH_HEADER" -H "$CONTENT_TYPE" "$API_URL" -d "$RELEASE_INFO") |
128 |
| -
|
129 |
| - ID=$(echo $RESPONSE | jq --raw-output '.id') |
130 |
| -
|
131 |
| - for file in ${{ github.workspace }}/build/*; do |
132 |
| - AUTH_HEADER="Authorization: token ${{ secrets.TWLBOT_TOKEN }}" |
133 |
| - CONTENT_LENGTH="Content-Length: $(stat -c%s $file)" |
134 |
| - CONTENT_TYPE="Content-Type: application/7z-x-compressed" |
135 |
| - UPLOAD_URL="https://uploads.github.com/repos/TWLBot/Builds/releases/$ID/assets?name=$(basename $file)" |
136 |
| -
|
137 |
| - curl -XPOST -H "$AUTH_HEADER" -H "$CONTENT_LENGTH" -H "$CONTENT_TYPE" --upload-file "$file" "$UPLOAD_URL" |
138 |
| - done |
139 |
| -
|
140 |
| - send_webhook: |
141 |
| - runs-on: ubuntu-latest |
142 |
| - needs: [publish_build, build] |
143 |
| - name: Send Discord webhook |
144 |
| - if: ${{ !startsWith(github.ref, 'refs/pull') }} |
145 |
| - env: |
146 |
| - CURRENT_DATE: ${{ needs.publish_build.outputs.current_date }} |
147 |
| - AUTHOR_NAME: ${{ needs.build.outputs.author_name }} |
148 |
| - COMMITTER_NAME: ${{ needs.build.outputs.committer_name }} |
149 |
| - COMMIT_SUBJECT: ${{ needs.build.outputs.commit_subject }} |
150 |
| - COMMIT_MESSAGE: ${{ needs.build.outputs.commit_message }} |
151 |
| - steps: |
152 |
| - - name: Send success webhook |
153 |
| - if: ${{ success() }} |
154 |
| - run: | |
155 |
| - curl -o send.sh https://raw.githubusercontent.com/DS-Homebrew/discord-webhooks/master/send-ghactions.sh |
156 |
| - chmod +x send.sh |
157 |
| - ./send.sh success ${{ secrets.WEBHOOK_URL }} |
158 |
| - - name: Send failure webhook |
159 |
| - if: ${{ failure() }} |
160 |
| - run: | |
161 |
| - curl -o send.sh https://raw.githubusercontent.com/DS-Homebrew/discord-webhooks/master/send-ghactions.sh |
162 |
| - chmod +x send.sh |
163 |
| - ./send.sh failure ${{ secrets.WEBHOOK_URL }} |
0 commit comments