Merge pull request #35 from segateway/dependabot/github_actions/docke… #184
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: Main CI | |
# | |
on: | |
push: | |
branches: | |
- "main" | |
- "next" | |
- "next-major" | |
pull_request: | |
branches: | |
- "main" | |
- "next" | |
- "next-major" | |
jobs: | |
meta: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
pages: write | |
outputs: | |
dockerhub-publish: ${{ steps.dockerhub-publish.outputs.defined }} | |
registry: ghcr.io/${{ github.repository_owner }}/containers/${{ github.event.repository.name }}:${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.version'] }} | |
container_tags: ${{ steps.docker_action_meta.outputs.tags }} | |
container_labels: ${{ steps.docker_action_meta.outputs.labels }} | |
container_buildtime: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.created'] }} | |
container_version: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.version'] }} | |
container_revision: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.revision'] }} | |
container_base: ${{ fromJSON(steps.docker_action_meta.outputs.json).tags[0] }} | |
new_release_version: ${{ steps.version.outputs.new_release_version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: false | |
persist-credentials: false | |
- id: dockerhub-publish | |
if: "${{ env.MY_KEY != '' }}" | |
run: echo "::set-output name=defined::true" | |
env: | |
MY_KEY: ${{ secrets.DOCKER_PASS }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Semantic Release | |
id: version | |
uses: cycjimmy/[email protected] | |
with: | |
semantic_version: 19.0.5 | |
extra_plugins: | | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
[email protected] | |
@semantic-release/[email protected] | |
dry_run: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REGISTRY_USERNAME: ${{ github.repository_owner }} | |
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: docker_action_meta | |
uses: docker/[email protected] | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/containers/${{ github.event.repository.name }} | |
flavor: | | |
latest=false | |
tags: | | |
type=sha,format=long | |
type=sha | |
type=semver,pattern={{version}},value=${{ steps.version.outputs.new_release_version }} | |
type=semver,pattern={{major}},value=${{ steps.version.outputs.new_release_version }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.new_release_version }} | |
type=ref,event=branch | |
type=ref,event=pr | |
type=ref,event=tag | |
labels: | | |
org.opencontainers.image.licenses=Apache-2.0 | |
runTests: | |
runs-on: ubuntu-latest | |
needs: [meta] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- uses: azure/setup-helm@v4 | |
# - name: Lint Azure | |
# run: | | |
# helm lint chart -f tests/common/host.yaml -f tests/common/humio.yaml -f tests/common/sso.yaml -f tests/azure/basic.yaml | |
Containerize: | |
runs-on: ubuntu-latest | |
needs: [runTests, meta] | |
permissions: | |
packages: write | |
contents: write | |
pages: write | |
steps: | |
#Yes we need code | |
- uses: actions/checkout@v4 | |
with: | |
submodules: false | |
persist-credentials: false | |
# These steps are quick and will work or if fail only because of external issues | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/[email protected] | |
if: github.event_name != 'pull_request' | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to ghcr for helm | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login --password-stdin -u ${{ github.repository_owner }} ghcr.io/${{ github.repository_owner }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- uses: azure/setup-helm@v4 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ needs.meta.outputs.container_base }} | |
labels: ${{ needs.meta.outputs.container_labels }} | |
build-args: | | |
BUILDTIME=${{ needs.meta.outputs.container_buildtime }} | |
VERSION=${{ needs.meta.outputs.container_version }} | |
REVISION=${{ needs.meta.outputs.container_revision }} | |
cache-from: type=registry,ref=${{ needs.meta.outputs.container_base }} | |
cache-to: type=inline | |
- name: Semantic Release | |
if: github.event_name != 'pull_request' | |
id: version | |
uses: cycjimmy/[email protected] | |
with: | |
semantic_version: 19.0.5 | |
extra_plugins: | | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
[email protected] | |
@semantic-release/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
SEGWAY_CHARTS_WRITE: ${{ secrets.SEGWAY_CHARTS_WRITE }} | |
SEGWAY_CHARTS_REPO: ${{ vars.SEGWAY_CHARTS_REPO }} |