diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d389e368..0aeaf159 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,6 @@ jobs: asset_name: TEST.md tag: ci-test-${{ matrix.os }}-${{ github.run_id }} overwrite: true - promote: true prerelease: true make_latest: true body: "rofl lol test%0Aianal %25 fubar" @@ -54,6 +53,38 @@ jobs: assert.deepStrictEqual(release.data.assets[0].name, "TEST.md") const actual = child_process.execSync(`curl -Ls ${release.data.assets[0].browser_download_url}`) assert.deepStrictEqual(expected, actual) + - name: Make test promote + uses: ./ + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: README.md + asset_name: TEST.md + tag: ci-test-${{ matrix.os }}-${{ github.run_id }} + overwrite: true + promote: true + prerelease: false + make_latest: true + body: "new body" + - name: Check that the release is promoted + uses: actions/github-script@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs') + const child_process = require('child_process'); + const assert = require('assert').strict; + + const expected = fs.readFileSync("README.md") + const release = await github.repos.getReleaseByTag({ + ...context.repo, + tag: "ci-test-${{ matrix.os }}-${{ github.run_id }}", + }) + assert.deepStrictEqual(release.data.prerelease, false) + assert.deepStrictEqual(release.data.make_latest, true) + assert.deepStrictEqual(release.data.body, "new body") + assert.deepStrictEqual(release.data.assets[0].name, "TEST.md") + const actual = child_process.execSync(`curl -Ls ${release.data.assets[0].browser_download_url}`) + assert.deepStrictEqual(expected, actual) - name: Clean up if: ${{ always() }} uses: actions/github-script@v2 diff --git a/action.yml b/action.yml index ec8d9033..d8e5e545 100644 --- a/action.yml +++ b/action.yml @@ -19,7 +19,7 @@ inputs: asset_name: description: 'Name of the asset. When not provided will use the file name. Unused if file_glob is set to "true".' overwrite: - description: 'Overwrite the assets/name/body in case the release already exists.' + description: 'Overwrite the release in case it already exists.' promote: description: 'Promote a prerelease to release' file_glob: