Build and check image #199
This file contains hidden or 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 and check image | |
on: | |
schedule: | |
- cron: "30 5 * * 1-5" | |
push: | |
branches: ["master"] | |
paths: | |
- "docker/**" | |
- ".github/workflows/**" | |
pull_request: | |
branches: ["master"] | |
paths: | |
- "docker/**" | |
- ".github/workflows/**" | |
env: | |
REGISTRY: ghcr.io | |
NAME_TAG: ghcr.io/rootshell-coder/xbash:5.2-alpine3.20 | |
LATEST_TAG: ghcr.io/rootshell-coder/xbash:latest | |
TRIVY_SECURITY: SECURITY.txt | |
jobs: | |
build: | |
name: Publish to github registry | |
runs-on: [ubuntu-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: docker | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
${{ env.LATEST_TAG }} | |
${{ env.NAME_TAG }} | |
check: | |
needs: [build] | |
name: Pull image | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check version | |
run: | | |
docker run --rm ghcr.io/rootshell-coder/trivy-cached:latest image ${{ env.LATEST_TAG }} --skip-db-update > ${{ env.TRIVY_SECURITY }} | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: RootShell-coder | |
author_email: [email protected] | |
message: "check" | |
add: "*.txt" |