Remove draft functionality as GitHub can't have tagged draft releases sadly

This commit is contained in:
Sven-Hendrik Haase
2020-07-03 10:06:41 +02:00
parent 3c84140b3e
commit 1daf68639d
6 changed files with 3 additions and 64 deletions

View File

@@ -65,57 +65,6 @@ jobs:
...context.repo,
release_id: release.data.id,
})
- name: Make test draft release
uses: ./
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: README.md
tag: ci-test-${{ matrix.os }}
overwrite: true
draft: true
prerelease: false
release_name: "ci-test-${{ matrix.os }} release name"
body: "some other text"
- name: Check that the uploaded asset is readable
uses: actions/github-script@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// This uses a draft release and as such doesn't create its own tags.
// We're re-using the ci-test tags created by the previous execution of this action.
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 }}",
})
assert.deepStrictEqual(release.data.name, "ci-test-${{ matrix.os }} release name")
assert.deepStrictEqual(release.data.draft, true)
assert.deepStrictEqual(release.data.prerelease, false)
assert.deepStrictEqual(release.data.body, "rofl lol test")
assert.deepStrictEqual(release.data.assets[0].name, "README.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
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const release = await github.repos.getReleaseByTag({
...context.repo,
tag: "ci-test-${{ matrix.os }}",
})
await github.repos.deleteRelease({
...context.repo,
release_id: release.data.id,
})
// As per above, even though this particular invocation didn't create tags as it was a draft release,
// we used them from the run before and we're now cleaning them up.
await github.git.deleteRef({
...context.repo,
ref: "tags/ci-test-${{ matrix.os }}",