stable #853
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
name: stable | |
on: | |
schedule: | |
- cron: '0 12 * * *' # everyday at noon | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
docker: | |
name: 'Stable Build' | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: 'actions/checkout@v2' | |
- uses: extractions/setup-just@v1 | |
- name: Check if we need a new stable | |
id: stablecheck | |
shell: bash | |
run: | | |
pip3 install --user toml | |
if python3 check_stable.py; then | |
echo "Stable tag missing; running all build steps" | |
echo '::set-output name=BUILD::YES' | |
else | |
echo "Stable tag found; skipping all build steps" | |
# Setting dummy tag evars to prevent steps below from failing | |
echo "TAG1=clux/muslrust:no1" >> $GITHUB_ENV | |
echo "TAG2=clux/muslrust:no2" >> $GITHUB_ENV | |
echo "TAG3=clux/muslrust:no3" >> $GITHUB_ENV | |
fi | |
- name: Build stable image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
load: true | |
build-args: | | |
CHANNEL=stable | |
tags: clux/muslrust:temp | |
if: ${{ steps.stablecheck.outputs.BUILD }} | |
- name: Compute tags | |
shell: bash | |
run: | | |
docker run clux/muslrust:temp rustc --version | |
RUST_VER="$(docker run clux/muslrust:temp rustc --version | grep -oE "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]")" | |
RUST_DATE="$(date +"%Y-%m-%d")" | |
RUST_CHANNEL=stable | |
echo "TAG1=clux/muslrust:${RUST_CHANNEL}" >> $GITHUB_ENV | |
echo "TAG2=clux/muslrust:${RUST_VER}-${RUST_CHANNEL}" >> $GITHUB_ENV | |
echo "TAG3=clux/muslrust:${RUST_VER}" >> $GITHUB_ENV | |
if: ${{ steps.stablecheck.outputs.BUILD }} | |
- name: Echo tags | |
shell: bash | |
run: | | |
echo $TAG1 | |
echo $TAG2 | |
echo $TAG3 | |
- name: Run tests | |
shell: bash | |
if: ${{ steps.stablecheck.outputs.BUILD }} | |
run: just test | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: clux | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push image under computed tags | |
uses: docker/build-push-action@v3 | |
if: ${{ steps.stablecheck.outputs.BUILD }} | |
with: | |
context: . | |
build-args: | | |
CHANNEL=stable | |
push: ${{ steps.stablecheck.outputs.BUILD == 'YES' && github.event_name != 'pull_request' }} | |
tags: ${{ env.TAG1 }},${{ env.TAG2 }},${{ env.TAG3 }} |