From a09c549019eb8abe5d3c048080b72fd8349e5e61 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Mon, 6 Dec 2021 00:55:24 +0200 Subject: [PATCH] Create download-button.yml --- .github/workflows/download-button.yml | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/download-button.yml diff --git a/.github/workflows/download-button.yml b/.github/workflows/download-button.yml new file mode 100644 index 0000000..a477590 --- /dev/null +++ b/.github/workflows/download-button.yml @@ -0,0 +1,33 @@ +name: "Download Button Action" + +on: + release: + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Get latest release + id: get-latest-release + uses: InsonusK/get-latest-release@v1.0.1 + with: + myToken: ${{ github.token }} + view_top: 1 + + - name: Update readme + run: | + GITHUB_USER="DenverCoder1" + REPO="readme-download-button-action" + FORMAT="zip" + VERSION="${{ steps.get-latest-release.outputs.tag_name }}" + COLOR="blue" + UPDATE=$(cat README.md | perl -0777 -pe 's#()(?:.|\n)*()#${1}\n[![Download ${FORMAT}](https://custom-icon-badges.herokuapp.com/badge/-Download-${COLOR}?style=for-the-badge&logo=download&logoColor=white "Download ${FORMAT}")](https://github.com/${GITHUB_USER}/${REPO}/archive/${VERSION}.${FORMAT})\n${2}#g') + echo "${UPDATE}" > README.md + + - uses: EndBug/add-and-commit@v7 + with: + message: 'docs: Bump version to ${{ steps.get-latest-release.outputs.tag_name }}' + default_author: github_actions