|
1 | | -# --- WARNING - This GitHub Action will no longer be maintained --- |
2 | | -The owner (dev-drprasad) and maintainer (thadguidry) do not see a need for continuing maintenance because the feature can now be handled directly with a line of code in your workflows with GitHub CLI [delete release](https://cli.github.com/manual/gh_release_delete). |
3 | | -This repo thus will soon be archived. |
4 | | - |
5 | 1 | # GitHub Action: Delete tag and release |
6 | 2 |
|
7 | | -## Usage |
8 | | -Add following step to your workflow: |
| 3 | +Fork of the original that updates to Node 20. |
9 | 4 |
|
10 | | -```yaml |
11 | | -- uses: dev-drprasad/[email protected] |
12 | | - with: |
13 | | - tag_name: v0.1.2 #(required) - The name of the tag to delete. This is expected to be solely the tag name, not the name of a git reference. |
14 | | - delete_release: true #(optional) default: true - also delete all releases and their assets that are associated to the tag name |
15 | | - repo: <owner>/<repoName> #(optional) default: repo running this action - the target repository. |
16 | | - github_token: ${{ secrets.GITHUB_TOKEN }} # (required) - a GitHub token with write access to the repo where tags and releases will be searched and deleted |
17 | | -``` |
| 5 | +**Note**: You may be able to skip using this if you are working on a GitHub-hosted runner, |
| 6 | +or you can install the `gh` tool, as `gh` now natively [can delete releases](https://cli.github.com/manual/gh_release_delete). |
| 7 | +For example: |
18 | 8 |
|
19 | | -## Developing |
20 | | -
|
21 | | -You can follow these instructions to get this project cloned to your local machine and ready for development. Note that |
22 | | -development requires at least [Node 20](https://nodejs.org/en/download) to be installed on your computer. |
23 | | -
|
24 | | -```shell |
25 | | -git clone https://github.com/dev-drprasad/delete-tag-and-release.git |
26 | | -cd delete-tag-and-release |
27 | | -npm install |
28 | | -``` |
29 | | - |
30 | | -Tests can be run via: |
31 | | - |
32 | | -```shell |
33 | | -npm test |
34 | | -``` |
35 | | - |
36 | | -Since this is a repo for a [GitHub Action](https://docs.github.com/en/actions), **every new commit that changes code must include a new bundle.** You can |
37 | | -generate a new bundle via running: |
38 | | - |
39 | | -```shell |
40 | | -npm run package |
41 | | -``` |
42 | | - |
43 | | -and committing the resulting changes that will be in the `dist/` folder. |
44 | | - |
45 | | -### Formatting and linting |
46 | | - |
47 | | -This project uses [ESLint](https://eslint.org/) for linting and [Prettier](https://prettier.io/) for source code formatting. You can run the lint checks by running: |
48 | | - |
49 | | -```shell |
50 | | -npm run lint |
51 | | -``` |
52 | | - |
53 | | -If you have lint errors that are automatically fixable, you can fix those by running: |
54 | | - |
55 | | -```shell |
56 | | -npm run lint:fix |
| 9 | +```yaml |
| 10 | + - name: Delete tag |
| 11 | + run: gh release delete $TAG --cleanup-tag |
| 12 | + env: |
| 13 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
57 | 14 | ``` |
58 | 15 |
|
59 | | -## Releasing |
| 16 | +--- |
60 | 17 |
|
61 | | -Releases are done by creating a new tag and pushing that tag to the repo. A new |
62 | | -release can be made via the following: |
| 18 | +Add the following step to your workflow: |
63 | 19 |
|
64 | | -```shell |
65 | | -git checkout master |
66 | | -git fetch |
67 | | -git pull |
68 | | -# choose either patch, minor, or major. See https://docs.npmjs.com/cli/v8/commands/npm-version#description for more info |
69 | | -npm version <patch/minor/major> |
70 | | -git push --follow-tags |
| 20 | +```yaml |
| 21 | +- uses: ClementTsang/[email protected] |
| 22 | + with: |
| 23 | + delete_release: true # default: false |
| 24 | + tag_name: v0.1.0 # tag name to delete |
| 25 | + repo: <owner>/<repoName> # target repo (optional). defaults to repo running this action |
| 26 | + env: |
| 27 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
71 | 28 | ``` |
72 | | - |
73 | | -This will update the version in the `package.json`, create a new commit based off of the master branch, and create a |
74 | | -new Git tag with that version that points to the new commit. Remember to use the `--follow-tags` flag when running |
75 | | -`git push`! Without it, the new tag won't be pushed. |
76 | | - |
0 commit comments