build #173
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: build | |
on: | |
schedule: | |
- cron: "0 12 * * */1" | |
release: | |
push: | |
branches: | |
- "master" | |
workflow_dispatch: | |
permissions: | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: "retrieve pgeth" | |
run: git clone https://github.com/kilnfi/pgeth /tmp/pgeth | |
- name: "generate:build_id" | |
run: | | |
branch=${GITHUB_REF##*/} | |
sha=${GITHUB_SHA::8} | |
ts=$(date +%s) | |
echo "BUILD_ID=${branch}-${sha}-${ts}" >> $GITHUB_ENV | |
if: github.event_name == 'push' | |
- name: "generate:build_id" | |
run: | | |
echo "BUILD_ID=${{ github.event.release.name }}" >> $GITHUB_ENV | |
if: github.event_name == 'release' | |
- name: "generate:build_id" | |
run: | | |
ts=$(date +%d%m%Y-%H%M%S) | |
echo "BUILD_ID=auto-${ts}" >> $GITHUB_ENV | |
if: github.event_name == 'schedule' | |
- name: "build the docker image with PLUGIN_REPOSITORIES=https://github.com/kilnfi/pgeth-monitoring" | |
run: cd /tmp/pgeth && docker build . -f Dockerfile.plugins --tag "ghcr.io/kilnfi/pgeth-monitoring:${{ env.BUILD_ID }}" --tag "ghcr.io/kilnfi/pgeth-monitoring:latest" --tag "ghcr.io/kilnfi/pgeth-monitoring:${GITHUB_SHA}" --build-arg PLUGIN_REPOSITORIES="https://github.com/kilnfi/pgeth-monitoring" | |
- name: "run version check to ensure plugin compatibility" | |
run: docker run --rm ghcr.io/kilnfi/pgeth-monitoring:${{ env.BUILD_ID }} version | |
- name: "login to ghcr" | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "push to ghcr" | |
run: | | |
docker push ghcr.io/kilnfi/pgeth-monitoring:latest | |
docker push ghcr.io/kilnfi/pgeth-monitoring:${GITHUB_SHA} | |
docker push ghcr.io/kilnfi/pgeth-monitoring:${{ env.BUILD_ID }} |