From 24ac4ed7b1b255ff6ba7afaa2c78e5ed058dfc76 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Mon, 30 Oct 2023 16:40:54 +0900 Subject: [PATCH] create update-latest-release action --- .github/workflows/update-latest-release.yml | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/update-latest-release.yml diff --git a/.github/workflows/update-latest-release.yml b/.github/workflows/update-latest-release.yml new file mode 100644 index 0000000..5f7d317 --- /dev/null +++ b/.github/workflows/update-latest-release.yml @@ -0,0 +1,29 @@ +name: update-latest-release +on: + workflow_dispatch: +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: echo ok > hello.txt + # - uses: actions/github-script@v6 + # with: + # script: | + # const { data: release } = await github.rest.repos.getLatestRelease(context.repo); + + # const name = "hello.txt"; + # const data = await require("node:fs").promises.readFile(name); + + # await github.rest.repos.uploadReleaseAsset({ + # ...context.repo, + # release_id: release.id, + # name, + # data, + # }); + - run: | + latest=$(gh release view --json tagName --jq .tagName) + gh release delete-asset "${latest}" hello.txt || : + gh release upload "${latest}" hello.txt + env: + GH_TOKEN: ${{ github.token }}