generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4002c36
commit 343a2c7
Showing
1 changed file
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,9 +38,65 @@ jobs: | |
env: | ||
IS_PRERELEASE: ${{ inputs.type == 'prerelease' }} | ||
|
||
- name: Get Current Version | ||
id: current-version | ||
run: echo "VERSION=$(dotnet msbuild -p:IsPreRelease=$IS_PRERELEASE --getProperty:Version)" | ||
env: | ||
IS_PRERELEASE: ${{ inputs.type == 'prerelease' }} | ||
|
||
# Creating this github release is what should trigger the actual releasing of the nuget package | ||
- name: Create GitHub Release | ||
run: echo "Create GitHub Release" | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
script: | | ||
const package = '${{ inputs.package }}'; | ||
const currentVersion = '${{ steps.current-version.outputs.VERSION }}'; | ||
// configure git | ||
await exec.exec(`git config user.name "github-actions"`); | ||
await exec.exec(`git config user.email "[email protected]"`); | ||
// Create tag | ||
const tag = `${package}_v${currentVersion}`; | ||
console.log(`Creating tag & release: ${tag}`); | ||
await exec.exec(`git tag "${tag}"`); | ||
await exec.exec(`git push origin --tags`); | ||
// Create release | ||
const { data } = await github.rest.repos.createRelease({ | ||
owner: "bitwarden", | ||
repo: "dotnet-extensions", | ||
tag_name: tag, | ||
target_commitish: "${{ github.event.ref }}", | ||
name: tag, | ||
body: "WIP", | ||
prerelease: ${{ inputs.type == 'prerelease' }}, | ||
generate_release_notes: true, | ||
}); | ||
console.log(`Uploading asset to: ${data.upload_url}`); | ||
const globber = await glob.create("*/*.nupkg"); | ||
const files = globber.glob(); | ||
const fs = require("fs"); | ||
for (const file of files) { | ||
console.log(`Uploading file: ${file}`); | ||
// do the upload | ||
const uploadResponse = await github.request({ | ||
method: "POST", | ||
url: data.upload_url, | ||
data: fs.readFileSync(file), | ||
}); | ||
console.log(`Upload response: ${uploadResponse.status}`); | ||
} | ||
console.log("Finished creating release."); | ||
- name: Run Version Bumper | ||
id: version-bumper | ||
|