diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0276e6..842eee0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,8 +4,8 @@ on: push: branches: - "**" - tags-ignore: - - "**" + tags: + - "!**" pull_request: jobs: @@ -84,19 +84,22 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v3 - - name: Create release + - name: Create tag + release id: create_release shell: bash run: | + SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7) + TAG="build-${SHORT_SHA}" + RESPONSE=$(curl -s -X POST \ -H "Authorization: token ${{ secrets.LIBSM64_TOKEN }}" \ -H "Content-Type: application/json" \ "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases" \ - -d '{ - "tag_name": "latest", - "name": "Snapshot Build", - "prerelease": true - }') + -d "{ + \"tag_name\": \"${TAG}\", + \"name\": \"Snapshot Build ${SHORT_SHA}\", + \"prerelease\": true + }") echo "$RESPONSE" @@ -108,22 +111,13 @@ jobs: run: | curl -X POST \ -H "Authorization: token ${{ secrets.LIBSM64_TOKEN }}" \ - -F "attachment=@libsm64_linux/run-test" \ - "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=run-test-linux" + -F "attachment=@libsm64_linux" \ + "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=libsm64_linux.zip - name: Upload Windows artifact shell: bash run: | - tar -czf windows.tar.gz libsm64_windows curl -X POST \ -H "Authorization: token ${{ secrets.LIBSM64_TOKEN }}" \ - -F "attachment=@windows.tar.gz" \ - "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=libsm64-windows.tar.gz" - - - name: Upload README - shell: bash - run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.LIBSM64_TOKEN }}" \ - -F "attachment=@README.md" \ - "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=README.md" \ No newline at end of file + -F "attachment=@libsm64_windows" \ + "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=libsm64_windows.zip \ No newline at end of file