Update lock file #15
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: Auto-update Server container | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build-container: | |
if: github.repository_owner == 'STBoyden' | |
name: Build server container | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "DATE=$(date +%d%m%Y_%H%M%S)" >> "$GITHUB_ENV" | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: STBoyden/codectrl-protobuf-specifications | |
path: crates/protobuf-bindings/protos | |
- name: Fetch cache if already exists | |
continue-on-error: true | |
uses: actions/cache@v3 | |
id: has-cache | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: server-${{ hashFiles('**/Cargo.lock') }} | |
- if: steps.has-cache.outputs.cache-hit != 'true' | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- if: steps.has-cache.outputs.cache-hit != 'true' | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- if: steps.has-cache.outputs.cache-hit != 'true' | |
name: Build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: false | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
ghcr.io/stboyden/codectrl:latest | |
ghcr.io/stboyden/codectrl:${{ github.sha }} | |
ghcr.io/stboyden/codectrl:${{ env.DATE }} | |
- if: steps.has-cache.outputs.cache-hit != 'true' | |
name: Push | |
run: | | |
set -x | |
docker push ghcr.io/stboyden/codectrl:latest | |
docker push ghcr.io/stboyden/codectrl:${{ github.sha }} | |
docker push ghcr.io/stboyden/codectrl:${{ env.DATE }} | |
set +x | |
echo "Pushed!" | |
echo "Pushed the following tags for the `codectrl` container" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "- \`${{ github.sha }}\` -- The commit that used for the update of the container" >> $GITHUB_STEP_SUMMARY | |
echo "- \`${{ env.DATE }}\` -- The date and time on which the update for the container was ran" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "The \`latest\` tag has been updated." >> $GITHUB_STEP_SUMMARY | |
- if: steps.has-cache.outputs.cache-hit == 'true' | |
name: Generate "no need" step summary | |
run: | | |
echo "No need to update `codectrl` container" >> $GITHUB_STEP_SUMMARY |