Repository navigation
add module management #296
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
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| types: [ opened, reopened, synchronize ] | |
| workflow_call: | |
| workflow_dispatch: | |
| name: ci-build | |
| env: | |
| REGISTRY: ghcr.io | |
| DOTNET_VERSION: 10.0.x | |
| jobs: | |
| tests: | |
| name: Tests (${{ matrix.name }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: repository-server-tunit | |
| project: RepositoryServer.Tests/RepositoryServer.Tests.csproj | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| dotnet-version: '${{ env.DOTNET_VERSION }}' | |
| - name: Run ${{ matrix.name }} tests | |
| run: | | |
| set -euo pipefail | |
| dotnet test -c Release --project ${{ matrix.project }} | |
| build: | |
| name: Build (${{ matrix.image }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - dockerfile: docker/RepositoryServer.Dockerfile | |
| image: repository-server | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build ${{ matrix.image }} | |
| uses: ./.github/actions/build-app | |
| with: | |
| dockerfile: ${{ matrix.dockerfile }} | |
| push: ${{ inputs.push || (github.ref_protected && github.event_name != 'pull_request') }} | |
| image: ${{ matrix.image }} | |
| platforms: ${{ inputs.platforms || 'linux/amd64' }} | |
| tag-prefix: ${{ inputs.tag-prefix || 'rn' }} | |
| promote-image: | |
| name: Promote Image (${{ matrix.image }}) | |
| needs: [build, tests] | |
| runs-on: ubuntu-latest | |
| if: ${{ inputs.push || (github.ref_protected && github.event_name != 'pull_request') }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - image: repository-server | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Promote Manifest ${{ matrix.image }} | |
| uses: ./.github/actions/promote-image | |
| with: | |
| image: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.image }} | |
| run-tag: ${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }} | |
| latest: ${{ inputs.latest || false }} | |
| deploy-prod-workflow: | |
| runs-on: ubuntu-latest | |
| needs: promote-image | |
| if: ${{ github.ref_type == 'branch' && github.event_name != 'pull_request' && github.ref_name == 'master' }} | |
| environment: production | |
| steps: | |
| - name: Send repository dispatch | |
| uses: OpenShock/actions/repository-dispatch@21ca2d511bca92cf24fb502fa302f82700822584 # v1.1.1 | |
| with: | |
| repo: openshock/kubernetes-cluster-gitops | |
| event-type: update-repository-server-prod | |
| client-payload: | | |
| {"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"} | |
| token: ${{ secrets.GITOPS_PAT }} | |
| deploy-dev: | |
| runs-on: ubuntu-latest | |
| needs: promote-image | |
| if: ${{ github.ref_type == 'branch' && github.event_name != 'pull_request' && github.ref_name == 'develop' }} | |
| environment: development | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| sparse-checkout: | | |
| .github | |
| - uses: ./.github/actions/watchtower-update | |
| with: | |
| url: ${{ vars.WATCHTOWER_URL }} | |
| token: ${{ secrets.WATCHTOWER_TOKEN }} |