diff --git a/.github/workflows/release-asset-creator.yml b/.github/workflows/release-asset-creator.yml new file mode 100644 index 0000000..e46c3b5 --- /dev/null +++ b/.github/workflows/release-asset-creator.yml @@ -0,0 +1,38 @@ +name: release-asset-creator +on: + release: + types: [published] +jobs: + my-job: + runs-on: ubuntu-latest + env: + ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }} + steps: + - name: download-source + run: curl -sL "${{ github.event.release.tarball_url }}" > "$ARCHIVE_NAME".tar.gz + - name: unzip-source + run: mkdir "$ARCHIVE_NAME" && tar -xzf "$ARCHIVE_NAME".tar.gz -C "$ARCHIVE_NAME" --strip-components 1 + - name: clean-source + run: rm -rf "$ARCHIVE_NAME"/.github + - name: create-checksum + run: sha256sum "$ARCHIVE_NAME".tar.gz > checksum.txt + - name: create-archive + run: tar -czf "$ARCHIVE_NAME".tar.gz "$ARCHIVE_NAME" + - name: upload-archive + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ env.ARCHIVE_NAME }}.tar.gz + asset_name: ${{ env.ARCHIVE_NAME }}.tar.gz + asset_content_type: application/gzip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: upload-checksum + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: checksum.txt + asset_name: checksum.txt + asset_content_type: text/plain + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}