Merge pull request #11 from tbobm/feat/add-http-api-dump #17
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 Containers" | |
'on': | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
tags: ["*"] | |
jobs: | |
release: | |
name: 'Create a release' | |
runs-on: "ubuntu-latest" | |
outputs: | |
release_version: steps.semantic-release.outputs.new_release_version | |
new_release: steps.semantic-release.outputs.new_release_published | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Semantic Release | |
id: semantic-release | |
uses: cycjimmy/semantic-release-action@v4 | |
with: | |
branches: | | |
[ | |
'main' | |
] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
matrix: | |
runs-on: "ubuntu-latest" | |
name: "Generate the matrix" | |
outputs: | |
matrix: ${{ steps.create-matrix.outputs.matrix }} | |
steps: | |
- name: "Checkout the code" | |
uses: "actions/checkout@v4" | |
- name: "Run generate_matrix.sh" | |
id: create-matrix | |
run: | | |
yq --version | |
matrix=$(./generate_matrix.sh | yq -I=0 -o=json) | |
echo matrix="$matrix" | |
echo "matrix=$(./generate_matrix.sh | yq -I=0 -o=json)" >> "$GITHUB_OUTPUT" | |
- name: "Display matrix" | |
run: echo '${{ steps.create-matrix.outputs.matrix }}' | |
check-matrix: | |
runs-on: ubuntu-latest | |
name: "Validate and display matrix" | |
needs: matrix | |
steps: | |
- name: Install json2yaml | |
run: | | |
sudo npm install -g json2yaml | |
- name: Check matrix definition | |
run: | | |
matrix='${{ needs.matrix.outputs.matrix }}' | |
echo $matrix | |
echo $matrix | jq . | |
echo $matrix | json2yaml | |
build-containers: | |
runs-on: "ubuntu-latest" | |
name: "Build and push OCIs" | |
needs: | |
- matrix | |
- release | |
strategy: | |
matrix: ${{fromJson(needs.matrix.outputs.matrix)}} | |
steps: | |
- name: "Checkout the code" | |
uses: "actions/checkout@v4" | |
- name: "GitHub Slug Action" | |
uses: rlespinasse/[email protected] | |
- name: "Set up Docker Buildx" | |
uses: docker/setup-buildx-action@v3 | |
- name: "Login to GitHub Container Registry" | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
mask-password: 'true' | |
- name: "Slugify path to create container tag" | |
id: slugify-src | |
env: | |
TARGET_SRC: ${{ matrix.target.src }} | |
run: | | |
echo "target-slug=$(echo $TARGET_SRC | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z)" >> "$GITHUB_OUTPUT" | |
- name: "Build container ${{ matrix.target.name }}" | |
uses: docker/build-push-action@v5 | |
with: | |
context: "${{ matrix.target.src }}" | |
push: true | |
provenance: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
"ghcr.io/${{ env.GITHUB_REPOSITORY }}:${{ steps.slugify-src.outputs.target-slug }}-latest" | |
"ghcr.io/${{ env.GITHUB_REPOSITORY }}:${{ steps.slugify-src.outputs.target-slug }}-${{ needs.release.outputs.new_release == 'true' && needs.release.outputs.release_version || env.GITHUB_REF_SLUG }}" |