-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workflow scripts improvements (#225)
* Send Discord notifications when new commits are added to the stable and testing branches and result in a successful CI build. * Factor out the logic for synchronizing with the remote server to a `sync-repository` action. * Factor out the logic for fetching build dependencies to a `setup` action.
- Loading branch information
1 parent
c7f3198
commit cb362f5
Showing
7 changed files
with
164 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Send a Discord message | ||
description: Send a message to a Discord channel | ||
inputs: | ||
channel: | ||
description: Identifier of the channel to send the message to | ||
required: true | ||
token: | ||
description: API access token | ||
required: true | ||
title: | ||
description: Title of the message to send | ||
required: true | ||
link: | ||
description: URL to link the message title to | ||
required: true | ||
color: | ||
description: Color to annotate the message with | ||
required: true | ||
message: | ||
description: Content of the message to send | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Post to the Discord REST API | ||
shell: bash | ||
env: | ||
MSG_TITLE: ${{ inputs.title }} | ||
MSG_LINK: ${{ inputs.link }} | ||
MSG_COLOR: ${{ inputs.color }} | ||
MSG_VALUE: ${{ inputs.message }} | ||
run: | | ||
payload="$(jq --null-input --compact-output --monochrome-output \ | ||
--arg title "$MSG_TITLE" \ | ||
--arg link "$MSG_LINK" \ | ||
--arg color "$MSG_COLOR" \ | ||
--arg message "$MSG_VALUE" \ | ||
'{ | ||
username: "Toltec", | ||
avatar_url: "https://avatars0.githubusercontent.com/u/71158884", | ||
embeds: [{ | ||
title: $title, | ||
url: $link, | ||
color: $color, | ||
description: $message, | ||
}] | ||
}')" | ||
curl --silent --show-error --fail \ | ||
--header "Content-Type: application/json" \ | ||
--data "$payload" \ | ||
'https://discord.com/api/webhooks/${{ inputs.channel }}/${{ inputs.token }}' |
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,37 @@ | ||
name: Setup Toltec dependencies | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install Ubuntu packages | ||
shell: bash | ||
run: | | ||
sudo apt-get update -yq | ||
sudo apt-get install -yq bsdtar tree | ||
- name: Install shfmt and Shellcheck | ||
shell: bash | ||
run: | | ||
install_dir=/usr/local/bin | ||
# Install shfmt | ||
shfmt_version=v3.2.1 | ||
shfmt_checksum=43439b996942b53dfafa9b6ff084f394555d049c98fb7ec37978f7668b43e1be | ||
sudo curl --location --silent --fail --tlsv1.2 --proto '=https' \ | ||
--output "$install_dir"/shfmt \ | ||
https://github.com/mvdan/sh/releases/download/"$shfmt_version"/shfmt_"$shfmt_version"_linux_amd64 | ||
sha256sum -c <(echo "$shfmt_checksum $install_dir/shfmt") > /dev/null 2>&1 | ||
sudo chmod a+x "$install_dir"/shfmt | ||
# Install Shellcheck (Ubuntu’s version is too old) | ||
shellcheck_version=v0.7.1 | ||
shellcheck_checksum=64f17152d96d7ec261ad3086ed42d18232fcb65148b44571b564d688269d36c8 | ||
shellcheck_arname=shellcheck.tar.xz | ||
curl --location --silent --fail --tlsv1.2 --proto '=https' \ | ||
--output "$shellcheck_arname" \ | ||
https://github.com/koalaman/shellcheck/releases/download/"$shellcheck_version"/shellcheck-"$shellcheck_version".linux.x86_64.tar.xz | ||
sha256sum -c <(echo "$shellcheck_checksum $shellcheck_arname") > /dev/null 2>&1 | ||
tar -xf "$shellcheck_arname" --strip-components=1 \ | ||
shellcheck-"$shellcheck_version"/shellcheck | ||
rm "$shellcheck_arname" | ||
chmod a+x shellcheck | ||
sudo chown root:root shellcheck | ||
sudo mv shellcheck "$install_dir" |
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,31 @@ | ||
name: Sync with remote repository | ||
description: Synchronize packages with a remote repository | ||
inputs: | ||
local-path: | ||
description: Path to the directory containing the packages to push | ||
required: true | ||
ssh-key: | ||
description: Private SSH key to access the remote repository | ||
required: true | ||
ssh-known-hosts: | ||
description: Public SSH key of the remote repository | ||
required: true | ||
remote-path: | ||
description: Path to the remote directory to place the packages in | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: rsync packages and index | ||
shell: bash | ||
run: | | ||
mkdir -p private | ||
chmod 700 private | ||
echo '${{ inputs.ssh-key }}' > private/id_rsa | ||
echo '${{ inputs.ssh-known-hosts }}' > private/known_hosts | ||
chmod 600 private/* | ||
rsync --archive --verbose --compress --delete \ | ||
-e "ssh -i private/id_rsa -o UserKnownHostsFile=private/known_hosts" \ | ||
'${{ inputs.local-path }}' \ | ||
'${{ inputs.remote-path }}' | ||
rm -r private |
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
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