-
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.
feat: Update CI (this might break everything)
- Loading branch information
Showing
15 changed files
with
53,660 additions
and
57 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: "create-release-assets" | ||
description: "Creates release assets." | ||
author: "Tormak" | ||
inputs: | ||
GITHUB_TOKEN: | ||
description: "Your GitHub token." | ||
required: true | ||
|
||
git_branch: | ||
description: "The target release branch." | ||
required: true | ||
|
||
release_id: | ||
description: "The target release id." | ||
required: true | ||
|
||
release_tag: | ||
description: "The target release tag." | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Update Release Assets | ||
uses: actions/github-script@v6 | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} | ||
release_id: ${{ inputs.release_id }} | ||
release_tag: ${{ inputs.release_tag }} | ||
git_branch: ${{ inputs.git_branch }} | ||
with: | ||
script: | | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
async function getReleaseAssetContents(id) { | ||
const contents = ( | ||
await github.request( | ||
'GET /repos/{owner}/{repo}/releases/assets/{asset_id}', | ||
{ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
asset_id: id, | ||
headers: { | ||
accept: 'application/octet-stream', | ||
}, | ||
} | ||
) | ||
).data; | ||
return contents; | ||
} | ||
async function deleteReleaseAsset(id) { | ||
await github.rest.repos.deleteReleaseAsset({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
asset_id: id | ||
}); | ||
} | ||
async function uploadReleaseAsset(name, contents) { | ||
await github.rest.repos.uploadReleaseAsset({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: process.env.release_id, | ||
name: name, | ||
data: contents | ||
}); | ||
} | ||
async function setReleaseAssetName(id, newName) { | ||
await github.rest.repos.updateReleaseAsset({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
asset_id: id, | ||
name: newName | ||
}); | ||
} | ||
const versionNoV = process.env.release_tag.substring(1); | ||
const GENERIC_NAMES = { | ||
"windowsInstaller": `CSSLoader.Desktop_${versionNoV}.msi`, | ||
"windowsUpdater": `CSSLoader.Desktop_${versionNoV}.msi.zip`, | ||
"windowsUpdaterSig": `CSSLoader.Desktop_${versionNoV}.msi.zip.sig`, | ||
} | ||
const assets = await github.rest.repos.listReleaseAssets({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: process.env.release_id | ||
}); | ||
const winInstaller = assets.data.find((asset) => asset.name.endsWith(".msi")); | ||
await setReleaseAssetName(winInstaller.id, GENERIC_NAMES["windowsInstaller"]); | ||
const winUpdater = assets.data.find((asset) => asset.name.endsWith(".msi.zip")); | ||
await setReleaseAssetName(winUpdater.id, GENERIC_NAMES["windowsUpdater"]); | ||
const winUpdaterSig = assets.data.find((asset) => asset.name.endsWith(".msi.zip.sig")); | ||
await setReleaseAssetName(winUpdaterSig.id, GENERIC_NAMES["windowsUpdaterSig"]); | ||
const latest = assets.data.find((asset) => asset.name === "latest.json"); | ||
const latestContentsBuff = Buffer.from(await getReleaseAssetContents(latest.id)); | ||
let latestContents = latestContentsBuff.toString(); | ||
await deleteReleaseAsset(latest.id); | ||
latestContents = latestContents.replace(winUpdater.name, GENERIC_NAMES["windowsUpdater"]); | ||
await uploadReleaseAsset("latest.json", Buffer.from(latestContents)); | ||
const latestPath = path.resolve(process.cwd(), "latest.json"); | ||
fs.writeFileSync(latestPath, Buffer.from(latestContents)); | ||
const config = (prop, value) => exec.exec(`git config ${prop} "${value}"`); | ||
const add = (file) => exec.exec(`git add ${file}`); | ||
const commit = (message) => exec.exec(`git commit -m "${message}"`); | ||
const push = (branch) => exec.exec(`git push origin ${branch} --follow-tags`); | ||
const updateOrigin = (repo) => exec.exec(`git remote set-url origin ${repo}`); | ||
core.setSecret(process.env.GITHUB_TOKEN); | ||
updateOrigin(`https://x-access-token:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git`); | ||
config('user.email', "[email protected]"); | ||
config('user.name', "CSSLoader Desktop Release Action"); | ||
await add("."); | ||
await commit("chore(release): updating latest.json to generated version."); | ||
await push(process.env.git_branch); | ||
core.info("Committed changes to latest.json complete!"); |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: 'custom-changelog-action' | ||
description: 'Generates changelogs for commitlint commits and is compatible with tauri.' | ||
author: 'Tormak' | ||
inputs: | ||
github-token: | ||
description: "Github token" | ||
default: ${{ github.token }} | ||
required: false | ||
|
||
git-message: | ||
description: "Commit message to use" | ||
default: "chore(release): {version}" | ||
required: false | ||
|
||
git-user-name: | ||
description: "The git user.name to use for the commit" | ||
default: "Conventional Changelog Action" | ||
required: false | ||
|
||
git-user-email: | ||
description: "The git user.email to use for the commit" | ||
default: "[email protected]" | ||
required: false | ||
|
||
git-pull-method: | ||
description: "The git pull method used when pulling all changes from remote" | ||
default: "--ff-only" | ||
required: false | ||
|
||
git-branch: | ||
description: "The git branch to be pushed" | ||
default: ${{ github.ref }} | ||
required: false | ||
|
||
tag-prefix: | ||
description: "Prefix that is used for the git tag" | ||
default: "v" | ||
required: false | ||
|
||
git-url: | ||
description: "Git Url" | ||
default: "github.com" | ||
required: false | ||
|
||
outputs: | ||
clean_changelog: | ||
description: "A tidied version of the generated changelog." | ||
|
||
tag: | ||
description: "The tag for the new release." | ||
|
||
version: | ||
description: "The version for the new release." | ||
|
||
runs: | ||
using: 'node16' | ||
main: 'dist/index.cjs' |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
* {{header}} | ||
|
||
{{~!-- commit link --}} {{#if @root.linkReferences~}} | ||
([{{hash}}]( | ||
{{~#if @root.repository}} | ||
{{~#if @root.host}} | ||
{{~@root.host}}/ | ||
{{~/if}} | ||
{{~#if @root.owner}} | ||
{{~@root.owner}}/ | ||
{{~/if}} | ||
{{~@root.repository}} | ||
{{~else}} | ||
{{~@root.repoUrl}} | ||
{{~/if}}/ | ||
{{~@root.commit}}/{{hash}})) | ||
{{~else}} | ||
{{~hash}} | ||
{{~/if}} | ||
|
||
{{~!-- commit references --}} | ||
{{~#if references~}} | ||
, closes | ||
{{~#each references}} {{#if @root.linkReferences~}} | ||
[ | ||
{{~#if this.owner}} | ||
{{~this.owner}}/ | ||
{{~/if}} | ||
{{~this.repository}}#{{this.issue}}]( | ||
{{~#if @root.repository}} | ||
{{~#if @root.host}} | ||
{{~@root.host}}/ | ||
{{~/if}} | ||
{{~#if this.repository}} | ||
{{~#if this.owner}} | ||
{{~this.owner}}/ | ||
{{~/if}} | ||
{{~this.repository}} | ||
{{~else}} | ||
{{~#if @root.owner}} | ||
{{~@root.owner}}/ | ||
{{~/if}} | ||
{{~@root.repository}} | ||
{{~/if}} | ||
{{~else}} | ||
{{~@root.repoUrl}} | ||
{{~/if}}/ | ||
{{~@root.issue}}/{{this.issue}}) | ||
{{~else}} | ||
{{~#if this.owner}} | ||
{{~this.owner}}/ | ||
{{~/if}} | ||
{{~this.repository}}#{{this.issue}} | ||
{{~/if}}{{/each}} | ||
{{~/if}} | ||
|
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{#if noteGroups}} | ||
{{#each noteGroups}} | ||
|
||
### {{title}} | ||
|
||
{{#each notes}} | ||
* {{text}} | ||
{{/each}} | ||
{{/each}} | ||
{{/if}} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## {{#if isPatch~}} <small> | ||
{{~/if~}} {{version}} | ||
{{~#if title}} "{{title}}" | ||
{{~/if~}} | ||
{{~#if date}} ({{date}}) | ||
{{~/if~}} | ||
{{~#if isPatch~}} </small> | ||
{{~/if}} | ||
|
Oops, something went wrong.