name: Docker on: push: branches: - master - release/* tags: - v* schedule: - cron: '0 0 * * *' workflow_dispatch: defaults: run: shell: bash permissions: {} jobs: docker: name: Docker (${{ matrix.image }} / ${{ matrix.network }}) [publish=${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}] runs-on: ubuntu-latest strategy: fail-fast: false matrix: image: - lotus-all-in-one network: - mainnet - butterflynet - calibnet - debug include: - image: lotus network: mainnet env: # Do not publish until CircleCI is deprecated PUBLISH: false # PUBLISH: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} steps: - id: channel env: IS_MASTER: ${{ github.ref == 'refs/heads/master' }} IS_TAG: ${{ startsWith(github.ref, 'refs/tags/') }} IS_RC: ${{ endsWith(github.ref, '-rc') }} IS_SCHEDULED: ${{ github.event_name == 'schedule' }} run: | channel='' if [[ "$IS_MASTER" == 'true' ]]; then if [[ "$IS_SCHEDULED" == 'true' ]]; then channel=nightly else channel=master fi elif [[ "$IS_TAG" == 'true' ]]; then if [[ "$IS_RC" == 'true' ]]; then channel=candidate else channel=stable fi fi echo "channel=$channel" | tee -a $GITHUB_ENV - uses: actions/checkout@v4 with: submodules: 'recursive' - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: filecoin/${{ matrix.image }} tags: | type=schedule type=raw,enable=${{ github.event_name != 'schedule' && steps.channel.outputs.channel != '' }},value=${{ steps.channel.outputs.channel }} type=ref,event=tag type=sha,prefix= flavor: | latest=false suffix=${{ matrix.network != 'mainnet' && format('-{0}', matrix.network) || '' }} - if: env.PUBLISH == 'true' name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push if channel is set (channel=${{ steps.channel.outputs.channel }}) uses: docker/build-push-action@v5 with: context: . push: ${{ env.PUBLISH == 'true' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | ${{ matrix.network != 'mainnet' && format('GOFLAGS=-tags={0}', matrix.network) || ''}}