build.yaml: cache from target #214
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 Container | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build_container: | |
| runs-on: rehosting-arc | |
| steps: | |
| - name: Setup runner | |
| run: | | |
| sudo apt-get update; | |
| sudo apt-get install -yy curl jq | |
| - name: Get next version | |
| uses: reecetech/version-increment@2023.10.1 | |
| id: version | |
| with: | |
| use_api: true | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: rehosting | |
| password: ${{secrets.DOCKERHUB_TOKEN}} | |
| - name: Trust Harbor's self-signed certificate | |
| run: | | |
| echo "Fetching certificate from ${{ secrets.REHOSTING_ARC_REGISTRY }}" | |
| openssl s_client -showcerts -connect ${{ secrets.REHOSTING_ARC_REGISTRY }}:443 < /dev/null 2>/dev/null | openssl x509 -outform PEM | sudo tee /usr/local/share/ca-certificates/harbor.crt > /dev/null | |
| sudo update-ca-certificates | |
| - name: Log in to Rehosting Arc Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ secrets.REHOSTING_ARC_REGISTRY }} | |
| username: ${{ secrets.REHOSTING_ARC_REGISTRY_USER }} | |
| password: ${{ secrets.REHOSTING_ARC_REGISTRY_PASSWORD }} | |
| - name: Install dependencies and label git workspace safe | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install git curl jq gzip tmux | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver-opts: | | |
| image=moby/buildkit:master | |
| network=host | |
| buildkitd-config-inline: | | |
| [registry."${{ secrets.REHOSTING_ARC_REGISTRY }}"] | |
| insecure = true | |
| http = true | |
| - name: Build Docker image and push to Dockerhub | |
| uses: docker/build-push-action@v6.18.0 | |
| with: | |
| context: . | |
| push: true | |
| cache-from: | | |
| type=registry,ref=${{secrets.REHOSTING_ARC_REGISTRY}}/rehosting/penguin:cache,mode=max | |
| type=registry,ref=${{secrets.REHOSTING_ARC_REGISTRY}}/rehosting/penguin:cache_last_published,mode=max | |
| cache-to: | | |
| type=registry,ref=${{secrets.REHOSTING_ARC_REGISTRY}}/rehosting/penguin:cache,mode=max | |
| type=registry,ref=${{secrets.REHOSTING_ARC_REGISTRY}}/rehosting/penguin:cache_last_published,mode=max | |
| tags: rehosting/penguin:${{ github.sha }},rehosting/penguin:${{ steps.version.outputs.v-version }},rehosting/penguin:latest | |
| build-args: | | |
| OVERRIDE_VERSION=${{ steps.version.outputs.v-version }} | |
| REGISTRY=${{ secrets.REHOSTING_ARC_REGISTRY }}/proxy | |
| - name: Create release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2.3.2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.v-version }} | |
| name: Release ${{ steps.version.outputs.v-version }} ${{ github.ref }} | |
| body: | | |
| Release ${{ steps.version.outputs.v-version }} @${{ github.ref }} | |
| draft: false | |
| generate_release_notes: true | |
| prerelease: false |