ci: standardize workflows using common-actions v2.0.0 #7
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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| packages: write | |
| security-events: write | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| # ========================================================================== | |
| # Semantic Release - Determine version | |
| # ========================================================================== | |
| semantic-release: | |
| name: Semantic Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_release_published: ${{ steps.release.outputs.new_release_published }} | |
| new_release_version: ${{ steps.release.outputs.new_release_version }} | |
| new_release_major_version: ${{ steps.release.outputs.new_release_major_version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Run semantic-release | |
| id: release | |
| uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6 | |
| with: | |
| extra_plugins: | | |
| @semantic-release/commit-analyzer | |
| @semantic-release/release-notes-generator | |
| @semantic-release/github | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ========================================================================== | |
| # Build, Scan and Push Docker Image | |
| # ========================================================================== | |
| publish-docker: | |
| name: Publish Docker Image | |
| needs: semantic-release | |
| if: needs.semantic-release.outputs.new_release_published == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| security-events: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| ref: v${{ needs.semantic-release.outputs.new_release_version }} | |
| - name: Setup Docker Buildx | |
| uses: dallay/common-actions/actions/setup-buildx@main | |
| - name: Build and Push Docker Image | |
| id: build | |
| uses: dallay/common-actions/actions/docker-build-push@main | |
| with: | |
| image-name: opencode | |
| image-title: "opencode" | |
| image-description: "Custom opencode Docker image with personal skills, commands, and agent configuration" | |
| dockerfile: Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| build-args: | | |
| OPENCODE_VERSION=1.4.3 | |
| github-owner: ${{ github.repository_owner }} | |
| dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} | |
| version: ${{ needs.semantic-release.outputs.new_release_version }} | |
| major-version: ${{ needs.semantic-release.outputs.new_release_major_version }} | |
| - name: Security Scan | |
| uses: dallay/common-actions/actions/docker-security-scan@main | |
| with: | |
| image-ref: ghcr.io/${{ github.repository_owner }}/opencode:${{ needs.semantic-release.outputs.new_release_version }} | |
| report-name: opencode-trivy | |
| category: opencode-trivy | |
| severity: HIGH,CRITICAL | |
| fail-on-error: false |