get.porter.sh/porter@v1.3.0/.github/workflows/build_pipelinesrelease_template.yml (about) 1 # Environment variables defined in a calling workflow are not accessible to this reusable workflow. Refer to the documentation for further details on this limitation. 2 name: build_pipelinesrelease_template 3 on: 4 workflow_call: 5 inputs: 6 goVersion: 7 required: false 8 default: 1.24.4 9 type: string 10 registry: 11 required: false 12 default: ghcr.io/getporter/test 13 type: string 14 shouldPublish: 15 required: false 16 default: false 17 type: boolean 18 skipTests: 19 required: false 20 default: false 21 type: boolean 22 jobs: 23 Validate-build: 24 name: Native Compile 25 runs-on: ubuntu-latest 26 steps: 27 - name: checkout 28 uses: actions/checkout@v4.1.0 29 - uses: actions/setup-go@v4 30 with: 31 go-version: ${{ inputs.goVersion }} 32 - name: Configure Agent 33 run: go run mage.go ConfigureAgent 34 - name: Native Build 35 run: mage build 36 shell: bash 37 - name: Publish Native Binaries 38 uses: actions/upload-artifact@v4.4.0 39 with: 40 name: build-bin 41 path: "${{ github.workspace }}/bin" 42 Validate-xbuild: 43 name: Cross Compile 44 runs-on: ubuntu-latest 45 steps: 46 - name: checkout 47 uses: actions/checkout@v4.1.0 48 with: 49 fetch-depth: 0 50 - uses: actions/setup-go@v4 51 with: 52 go-version: ${{ inputs.goVersion }} 53 - name: Configure Agent 54 run: go run mage.go ConfigureAgent 55 - name: Cross Compile 56 run: mage XBuildAll 57 shell: bash 58 - name: Publish Release Binaries 59 uses: actions/upload-artifact@v4.4.0 60 with: 61 name: xbuild-bin 62 path: "${{ github.workspace }}/bin" 63 Validate-VetLint: 64 name: Vet and Lint 65 runs-on: ubuntu-latest 66 steps: 67 - name: checkout 68 uses: actions/checkout@v4.1.0 69 - uses: actions/setup-go@v4 70 with: 71 go-version: ${{ inputs.goVersion }} 72 - name: Configure Agent 73 run: go run mage.go ConfigureAgent 74 - name: Vet 75 run: mage Vet 76 shell: bash 77 - name: Lint 78 run: mage Lint 79 shell: bash 80 Validate-unit_test: 81 name: Unit Test 82 runs-on: ubuntu-latest 83 if: ${{inputs.skipTests == false}} 84 steps: 85 - name: checkout 86 uses: actions/checkout@v4.1.0 87 - uses: actions/setup-go@v4 88 with: 89 go-version: ${{ inputs.goVersion }} 90 - name: Configure Agent 91 run: go run mage.go ConfigureAgent 92 - name: Unit Test 93 run: mage TestUnit 94 shell: bash 95 Validate-integration_test: 96 name: Integration Test 97 needs: 98 - Validate-build 99 uses: "./.github/workflows/porter-integration-release.yml" 100 with: 101 registry: ${{inputs.registry}} 102 Validate-smoke_test: 103 name: Run smoke tests on 104 needs: 105 - Validate-xbuild 106 runs-on: ubuntu-latest 107 if: success() && ${{inputs.skipTests == false}} 108 steps: 109 - name: checkout 110 uses: actions/checkout@v4.1.0 111 - uses: actions/setup-go@v4 112 with: 113 go-version: ${{ inputs.goVersion }} 114 - name: Download Cross-Compiled Porter Binaries 115 uses: actions/download-artifact@v4.1.8 116 with: 117 name: xbuild-bin 118 path: bin 119 - name: Setup Bin 120 run: go run mage.go ConfigureAgent UseXBuildBinaries 121 - name: Run Smoke Tests 122 run: mage -v TestSmoke 123 publish_binaries: 124 name: Publish Binaries 125 needs: 126 - Validate-build 127 - Validate-xbuild 128 - Validate-VetLint 129 - Validate-unit_test 130 - Validate-integration_test 131 - Validate-smoke_test 132 runs-on: ubuntu-latest 133 permissions: write-all 134 if: success() && ${{ inputs.shouldPublish == true }} 135 steps: 136 - name: checkout 137 uses: actions/checkout@v4.1.0 138 with: 139 fetch-depth: 0 140 - uses: actions/setup-go@v4 141 with: 142 go-version: ${{ inputs.goVersion }} 143 - name: Download Cross-Compiled Porter Binaries 144 uses: actions/download-artifact@v4.1.8 145 with: 146 name: xbuild-bin 147 path: bin 148 - name: Setup Bin 149 run: go run mage.go ConfigureAgent UseXBuildBinaries 150 - name: Publish Porter Binaries 151 env: 152 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 153 VERSION: ${{github.ref_name}} 154 run: mage PublishPorter 155 - name: Publish Porter Mixins 156 env: 157 GITHUB_TOKEN: "${{ secrets.PUBLISH_TOKEN }}" 158 VERSION: ${{github.ref_name}} 159 run: mage PublishMixins 160 publish-ghcr: 161 env: 162 DOCKER_REGISTRY: ${{inputs.registry}} 163 DOCKER_USERNAME: getporterbot 164 VERSION: ${{github.ref_name}} 165 name: Publish Docker Images 166 needs: 167 - Validate-build 168 - Validate-xbuild 169 - Validate-VetLint 170 - Validate-unit_test 171 - Validate-integration_test 172 - Validate-smoke_test 173 runs-on: ubuntu-latest 174 permissions: write-all 175 if: success() && ${{inputs.shouldPublish == true}} 176 steps: 177 - name: checkout 178 uses: actions/checkout@v4.1.0 179 with: 180 fetch-depth: 0 181 - uses: actions/setup-go@v4 182 with: 183 go-version: ${{ inputs.goVersion }} 184 - name: Download Cross-Compiled Porter Binaries 185 uses: actions/download-artifact@v4.1.8 186 with: 187 name: xbuild-bin 188 path: bin 189 - name: Setup Bin 190 run: go run mage.go ConfigureAgent UseXBuildBinaries 191 - name: Login to Container Registry 192 uses: docker/login-action@v3.0.0 193 with: 194 registry: "${{inputs.registry}}" 195 username: "${{ github.actor }}" 196 password: "${{ secrets.GITHUB_TOKEN }}" 197 - name: Publish Docker Images to ${{inputs.registry}} 198 run: PORTER_REGISTRY=${{inputs.registry}} mage PublishImages PublishServerMultiArchImages 199