|
| 1 | +name: Fluent Docker release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - fluent |
| 12 | + tags: |
| 13 | + - fluent-v*.*.* |
| 14 | + |
| 15 | +env: |
| 16 | + CARGO_TERM_COLOR: always |
| 17 | + DOCKER_IMAGE_NAME: ghcr.io/fluentlabs-xyz/rundler |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + name: build and push |
| 22 | + if: github.repository == 'fluentlabs-xyz/rundler' |
| 23 | + runs-on: ubuntu-22.04 |
| 24 | + permissions: |
| 25 | + packages: write |
| 26 | + contents: read |
| 27 | + steps: |
| 28 | + - name: Checkout sources |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + submodules: recursive |
| 32 | + |
| 33 | + - name: Install toolchain |
| 34 | + |
| 35 | + with: |
| 36 | + components: clippy |
| 37 | + |
| 38 | + - name: Install toolchain (nightly) |
| 39 | + run: rustup toolchain add nightly --component rustfmt --profile minimal |
| 40 | + |
| 41 | + - uses: Swatinem/rust-cache@v2 |
| 42 | + with: |
| 43 | + cache-on-failure: true |
| 44 | + |
| 45 | + - uses: taiki-e/install-action@cross |
| 46 | + |
| 47 | + - name: Login to GitHub Container Registry |
| 48 | + uses: docker/login-action@v3 |
| 49 | + with: |
| 50 | + registry: ghcr.io |
| 51 | + username: ${{ github.actor }} |
| 52 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + |
| 54 | + - name: Set up Docker builder |
| 55 | + run: | |
| 56 | + docker run --privileged --rm tonistiigi/binfmt --install arm64,amd64 |
| 57 | + docker buildx create --use --name cross-builder |
| 58 | +
|
| 59 | + - name: Build and push image |
| 60 | + run: | |
| 61 | + if [ -n "${{ github.event.inputs.version }}" ]; then |
| 62 | + sudo -E env "PATH=$PATH" DOCKER_IMAGE_NAME="${DOCKER_IMAGE_NAME}" make GIT_TAG="${{ github.event.inputs.version }}" docker-build |
| 63 | + elif [[ "${{ github.ref_name }}" =~ ^fluent-v(\d+)\.(\d+)\.(\d+)$ ]]; then |
| 64 | + sudo -E env "PATH=$PATH" DOCKER_IMAGE_NAME="${DOCKER_IMAGE_NAME}" make docker-build-latest |
| 65 | + else |
| 66 | + sudo -E env "PATH=$PATH" DOCKER_IMAGE_NAME="${DOCKER_IMAGE_NAME}" make GIT_TAG="${{ github.ref_name }}" docker-build |
| 67 | + fi |
0 commit comments