{"id":20462012,"url":"https://github.com/denvercoder1/readme-download-button-action","last_synced_at":"2025-07-26T12:40:17.281Z","repository":{"id":39593294,"uuid":"435293162","full_name":"DenverCoder1/readme-download-button-action","owner":"DenverCoder1","description":"GitHub Action workflow configuration for keeping a direct download link to the latest version on your repo's readme","archived":false,"fork":false,"pushed_at":"2023-08-01T16:15:36.000Z","size":19,"stargazers_count":25,"open_issues_count":0,"forks_count":39,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T22:51:17.098Z","etag":null,"topics":["actions","actionshackathon21","github-workflow"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DenverCoder1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-05T22:23:17.000Z","updated_at":"2025-03-10T01:33:11.000Z","dependencies_parsed_at":"2024-11-15T12:39:47.988Z","dependency_job_id":null,"html_url":"https://github.com/DenverCoder1/readme-download-button-action","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenverCoder1%2Freadme-download-button-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenverCoder1%2Freadme-download-button-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenverCoder1%2Freadme-download-button-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenverCoder1%2Freadme-download-button-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DenverCoder1","download_url":"https://codeload.github.com/DenverCoder1/readme-download-button-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248671277,"owners_count":21143061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","actionshackathon21","github-workflow"],"created_at":"2024-11-15T12:29:34.407Z","updated_at":"2025-04-13T06:20:35.672Z","avatar_url":"https://github.com/DenverCoder1.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Readme Download Button Action\n\nGitHub Action workflow configuration for keeping a direct download link of the latest version in your README.md file.\n\n## Example\n\nWith a single click of the button below, a zip of this repository will start downloading.\n\n\u003c!-- BEGIN LATEST DOWNLOAD BUTTON --\u003e\n[![Download zip](https://custom-icon-badges.demolab.com/badge/-Download-blue?style=for-the-badge\u0026logo=download\u0026logoColor=white \"Download zip\")](https://github.com/DenverCoder1/readme-download-button-action/archive/1.0.2.zip)\n\u003c!-- END LATEST DOWNLOAD BUTTON --\u003e\n\nThe URL this button leads to is automatically updated on each release by this [workflow](.github/workflows/download-button.yml).\n\n## Basic Usage\n\nThis workflow consists mainly of four parts:\n\n- Checkout the latest version of the repo with [actions/checkout](https://github.com/actions/checkout)\n- Get the latest release with [InsonusK/get-latest-release](https://github.com/InsonusK/get-latest-release)\n- Insert a download button for the latest version in the readme using a custom shell script\n- Update the readme with [EndBug/add-and-commit](https://github.com/EndBug/add-and-commit)\n\n### Step 1\n\nAdd the following snippet within your README.md file anywhere you want the button to appear:\n\n```md\n\u003c!-- BEGIN LATEST DOWNLOAD BUTTON --\u003e\n\u003c!-- END LATEST DOWNLOAD BUTTON --\u003e\n```\n\n### Step 2\n\nCreate a workflow by placing the following in a `.yml` file in your `.github/workflows/` directory:\n\n```yml\nname: \"Download Button Action\"\n\non:\n  release:\n    types:\n      - published\n  workflow_dispatch:\n\njobs:\n  release:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n\n      - name: Get latest release\n        id: get-latest-release\n        uses: InsonusK/get-latest-release@v1.0.1\n        with:\n          myToken: ${{ github.token }}\n          view_top: 1\n\n      - name: Readme Download Button Action\n        env:\n          GITHUB_USER: \"DenverCoder1\"\n          REPO: \"readme-download-button-action\"\n          FORMAT: \"zip\"\n          VERSION: \"${{ steps.get-latest-release.outputs.tag_name }}\"\n          COLOR: \"blue\"\n          BEGIN_TAG: \"\u003c!-- BEGIN LATEST DOWNLOAD BUTTON --\u003e\"\n          END_TAG: \"\u003c!-- END LATEST DOWNLOAD BUTTON --\u003e\"\n        run: |\n          UPDATE=$(cat README.md | perl -0777 -pe 's#(${{ env.BEGIN_TAG }})(?:.|\\n)*?(${{ env.END_TAG }})#${1}\\n[![Download ${{ env.FORMAT }}](https://custom-icon-badges.demolab.com/badge/-Download-${{ env.COLOR }}?style=for-the-badge\u0026logo=download\u0026logoColor=white \"Download ${{ env.FORMAT }}\")](https://github.com/${{ env.GITHUB_USER }}/${{ env.REPO }}/archive/${{ env.VERSION }}.${{ env.FORMAT }})\\n${2}#g')\n          echo \"${UPDATE}\" \u003e README.md\n\n      - uses: EndBug/add-and-commit@v7\n        with:\n          message: \"docs(readme): Bump download button version to ${{ steps.get-latest-release.outputs.tag_name }}\"\n          default_author: github_actions\n          branch: main\n```\n\n### Step 3\n\nUpdate the variables in the `env` section of the `Readme Download Button Action` step to include your username and repo along with any configuration you want as described below in the [Options](#options) section.\n\n## Options\n\nIn the `Readme Download Button Action` step of the workflow, the following environment variables must be set:\n\n| Variable      | Example                                 | Description                                             |\n| ------------- | --------------------------------------- | ------------------------------------------------------- |\n| `GITHUB_USER` | \"DenverCoder1\"                          | The GitHub username of the user who owns the repository |\n| `REPO`        | \"readme-download-button-action\"         | The name of the repository                              |\n| `FORMAT`      | \"zip\", \"tar.gz\"                         | The file format to download (`zip` or `tar.gz`)         |\n| `VERSION`     | \"0.0.1\", `\u003ctag of latest release\u003e`*     | The tag name of the release                             |\n| `COLOR`       | \"blue\", \"0088AA\"                        | The color of the download button (name or hex code)     |\n| `BEGIN_TAG`   | `\u003c!-- BEGIN LATEST DOWNLOAD BUTTON --\u003e` | The beginning tag of the download button                |\n| `END_TAG`     | `\u003c!-- END LATEST DOWNLOAD BUTTON --\u003e`   | The ending tag of the download button                   |\n\n*For using the latest release, include the `get-latest-release` step and set `VERSION` to `${{ steps.get-latest-release.outputs.tag_name }}`\n\n## Advanced Usage\n\nThis workflow can also be used in combination with other actions for automatically creating tags and releases in addition to updating the readme.\n\nFor example:\n\n- Calculate the next version number based on the latest release with a shell script or an action for [Semantic Versioning](https://semver.org/)\n- Create a tag with [tvdias/github-tagger](https://github.com/tvdias/github-tagger)\n- Create a release with a changelog using [fregante/release-with-changelog](https://github.com/fregante/release-with-changelog)\n\n\n```yml\nname: \"Automatic Release\"\n\non:\n  push:\n    branches:\n      - master\n  workflow_dispatch:\n\njobs:\n  release:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n\n      - name: Get latest release\n        id: get-latest-release\n        uses: InsonusK/get-latest-release@v1.0.1\n        with:\n          myToken: ${{ github.token }}\n          view_top: 1\n      \n      - name: Get next tag\n        id: next-tag\n        run: |\n          prev_version=$(echo \"${{ steps.get-latest-release.outputs.tag_name }}\" | sed -E 's/\\..*//g')\n          echo \"Previous version: $((prev_version))\"\n          echo \"Next version: $((prev_version+1))\"\n          echo \"::set-output name=tag::$((prev_version+1)).0\"\n          \n      - name: Create tag\n        uses: tvdias/github-tagger@v0.0.1\n        with:\n          repo-token: \"${{ secrets.GITHUB_TOKEN }}\"\n          tag: ${{ steps.next-tag.outputs.tag }}\n\n      - uses: fregante/release-with-changelog@v3\n        id: release-with-changelog\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          exclude: '^meta|^docs|^document|^lint|^ci|^refactor|readme|workflow|bump|dependencies|yml|^v?\\d+\\.\\d+\\.\\d+'\n          tag: ${{ steps.next-tag.outputs.tag }}\n          title: 'Version ${{ steps.next-tag.outputs.tag }}'\n          commit-template: '- {hash} {title}'\n          skip-on-empty: true\n          template: |\n            ### Changelog\n\n            {commits}\n\n            {range}\n            \n      - name: Delete tag if release skipped\n        if: ${{ steps.release-with-changelog.outputs.skipped == 'true' }}\n        run: |\n          git tag -d ${{ steps.next-tag.outputs.tag }}\n          git push origin :refs/tags/${{ steps.next-tag.outputs.tag }}\n\n      - name: Readme Download Button Action\n        if: ${{ steps.release-with-changelog.outputs.skipped == 'false' }}\n        env:\n          GITHUB_USER: \"DenverCoder1\"\n          REPO: \"readme-download-button-action\"\n          FORMAT: \"zip\"\n          VERSION: \"${{ steps.next-tag.outputs.tag }}\"\n          COLOR: \"blue\"\n          BEGIN_TAG: \"\u003c!-- BEGIN LATEST DOWNLOAD BUTTON --\u003e\"\n          END_TAG: \"\u003c!-- END LATEST DOWNLOAD BUTTON --\u003e\"\n        run: |\n          UPDATE=$(cat README.md | perl -0777 -pe 's#(${{ env.BEGIN_TAG }})(?:.|\\n)*?(${{ env.END_TAG }})#${1}\\n[![Download ${{ env.FORMAT }}](https://custom-icon-badges.demolab.com/badge/-Download-${{ env.COLOR }}?style=for-the-badge\u0026logo=download\u0026logoColor=white \"Download ${{ env.FORMAT }}\")](https://github.com/${{ env.GITHUB_USER }}/${{ env.REPO }}/archive/${{ env.VERSION }}.${{ env.FORMAT }})\\n${2}#g')\n          echo \"${UPDATE}\" \u003e README.md\n\n      - uses: EndBug/add-and-commit@v7\n        if: ${{ steps.release-with-changelog.outputs.skipped == 'false' }}\n        with:\n          message: 'docs: Bump version to ${{ steps.next-tag.outputs.tag }}'\n          default_author: github_actions\n```\n\n## License\n\nThis work is under an [MIT license](LICENSE)\n\n## Support\n\nIf you like this project, give it a ⭐ and share it with friends!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenvercoder1%2Freadme-download-button-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenvercoder1%2Freadme-download-button-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenvercoder1%2Freadme-download-button-action/lists"}