-
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.
Impl triggering beta images build via GitHub Actions
- Loading branch information
Showing
4 changed files
with
76 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
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,30 @@ | ||
name: Trigger beta images build | ||
|
||
on: | ||
schedule: | ||
- cron: '10 5 * * *' | ||
#push: | ||
# branches: ["dev"] | ||
|
||
jobs: | ||
trigger: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
os: | ||
- alpine3.10 | ||
- buster | ||
- buster-slim | ||
- stretch | ||
- stretch-slim | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
- run: bash ./check-and-trigger-beta-builds.sh | ||
env: | ||
IMAGE_OS: ${{ matrix.os }} | ||
TRIGGER_TOKEN: ${{ secrets.BETA_TRIGGER_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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/.idea/ | ||
/*.iml | ||
.DS_Store | ||
|
||
/*-beta.toml |
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,39 @@ | ||
#!/bin/bash | ||
|
||
|
||
if [ -z "$IMAGE_OS" ]; then | ||
echo "error: No IMAGE_OS env var provided" | ||
exit 1 | ||
fi | ||
if [ -z "$TRIGGER_TOKEN" ]; then | ||
echo "error: No TRIGGER_TOKEN env var provided" | ||
exit 1 | ||
fi | ||
|
||
|
||
set -e | ||
|
||
curl -fL -o ./channel-rust-beta.toml \ | ||
https://static.rust-lang.org/dist/channel-rust-beta.toml | ||
currentToolchainVer=$(grep -A1 '\[pkg.rustc]' channel-rust-beta.toml \ | ||
| grep version \ | ||
| cut -d '"' -f2 \ | ||
| tr -d "\n") | ||
echo "--> Current toolchain version: rustc $currentToolchainVer" | ||
|
||
docker pull instrumentisto/rust:beta-$IMAGE_OS | ||
latestImageVer=$(docker run --rm instrumentisto/rust:beta-$IMAGE_OS \ | ||
rustc -V \ | ||
| tr -d "\n") | ||
echo "--> Latest image version: $latestImageVer" | ||
|
||
if [ "rustc $currentToolchainVer" != "$latestImageVer" ]; then | ||
curl -sS -H "Content-Type: application/json" \ | ||
--data "{\"build\":true,\"docker_tag\":\"beta-$IMAGE_OS\"}" \ | ||
-X POST \ | ||
https://cloud.docker.com/api/build/v1/source/$TRIGGER_TOKEN/call/ \ | ||
>/dev/null \ | ||
&& echo "--> Build trigerred" | ||
else | ||
echo "--> Image is up-to-date, no need to trigger build" | ||
fi |