Build and Publish Snapshot #507
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 Publish Snapshot | |
| env: | |
| GO_VERSION: '1.25.4' | |
| GO_LINTER_VERSION: 'v2.5.0' | |
| DOCKER_REGISTRY_ACCOUNT: ${{ vars.DOCKER_REGISTRY_ACCOUNT }} | |
| on: | |
| schedule: | |
| - cron: '20 20 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| nightly: | |
| runs-on: ubuntu-latest | |
| # Set up a two build strategy, one with Kakadu and one without | |
| strategy: | |
| matrix: | |
| kakadu: ['Include Kakadu', 'Exclude Kakadu'] | |
| fail-fast: false | |
| env: | |
| KAKADU_VERSION: ${{ matrix.kakadu == 'Include Kakadu' && secrets.KAKADU_VERSION || '' }} | |
| steps: | |
| - name: Extract service name from repo name | |
| run: echo "SERVICE_NAME=$(echo '${{ github.repository }}' | cut -d'/' -f2)" >> $GITHUB_ENV | |
| - name: Checkout code | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| # Set up the Go environment | |
| - name: Setup Go | |
| uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version: "${{ env.GO_VERSION }}" | |
| - name: Install Go linter | |
| run: | | |
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \ | |
| sh -s -- -b $(go env GOPATH)/bin ${{ env.GO_LINTER_VERSION }} | |
| - name: Install oapi-codegen # v2.4.1 | |
| run: | | |
| go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@9c09ef9e9d4be639bd3feff31ff2c06961421272 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | |
| - name: Optionally, login to Docker repository | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| env: | |
| DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
| if: env.DOCKER_USERNAME != null | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Import Kakadu SSH key on GitHub | |
| if: env.ACT != 'true' | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.KAKADU_SSH_KEY }}" > ~/.ssh/kakadu_github_key | |
| # On ACT, we encode the SSH key using Base64 so it can be passed on the command line | |
| - name: Import Kakadu SSH key while running in ACT | |
| if: env.ACT == 'true' | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY_B64 }}" | base64 -d > ~/.ssh/kakadu_github_key | |
| - name: Configure Kakadu SSH key | |
| run: | | |
| chmod 600 ~/.ssh/kakadu_github_key | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| eval "$(ssh-agent -s)" | |
| ssh-add ~/.ssh/kakadu_github_key | |
| echo "Host github.com | |
| IdentityFile ~/.ssh/kakadu_github_key | |
| IdentitiesOnly yes | |
| StrictHostKeyChecking accept-new" >> ~/.ssh/config | |
| # Build and test the application (also lints) | |
| - name: Build project | |
| run: make all docker-push | |
| env: | |
| VERSION: nightly |