From 634ef5fc2124a0e9057b900cf9cd88c8de1938af Mon Sep 17 00:00:00 2001 From: Jatuphum Tungsilsukchai <43282496+jatu-studiobox@users.noreply.github.com> Date: Fri, 11 Mar 2022 22:48:58 +0700 Subject: [PATCH] Add new action release-asset-creator --- .../workflows/03-release-asset-creator.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/03-release-asset-creator.yml diff --git a/.github/workflows/03-release-asset-creator.yml b/.github/workflows/03-release-asset-creator.yml new file mode 100644 index 0000000..c1bdabf --- /dev/null +++ b/.github/workflows/03-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-archive + run: tar -czf "$ARCHIVE_NAME".tar.gz "$ARCHIVE_NAME" + - name: create-checksum + run: sha256sum "$ARCHIVE_NAME".tar.gz >checksum.txt + - 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 }}