Build container image #10258
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 container image | |
"on": | |
workflow_dispatch: | |
schedule: | |
- cron: "0 8-22 * * *" | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/build-container-image.yml | |
- Containerfile | |
- files/** | |
- patches/** | |
- scripts/* | |
pull_request: | |
paths: | |
- .github/workflows/build-container-image.yml | |
- Containerfile | |
- files/** | |
- patches/** | |
- scripts/* | |
jobs: | |
build-container-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build container image | |
run: scripts/build.sh | |
env: | |
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} | |
GIT_SHA: ${{ github.sha }} | |
REPOSITORY: osism/osism-ansible | |
- name: Get short revision ID | |
id: revision | |
shell: bash | |
run: echo "::set-output name=short::$(git rev-parse --short HEAD)" | |
- name: Generate SBOM | |
uses: anchore/sbom-action@v0 | |
with: | |
artifact-name: osism-ansible.spdx | |
image: "osism-ansible:${{ steps.revision.outputs.short }}" | |
- name: Push container image | |
run: | | |
scripts/push.sh | |
env: | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
REPOSITORY: osism/osism-ansible | |
if: | | |
github.repository == 'osism/container-image-osism-ansible' && | |
github.ref == 'refs/heads/main' |