diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 71330ba..7f2751e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -65,43 +65,3 @@ jobs: with: version: latest args: release --snapshot --skip-publish --rm-dist --debug - - publish_dev_image: - name: Publish Dev Image - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' && github.event_name == 'push' - steps: - - name: Check out - uses: actions/checkout@v3 - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: ~1.16 - id: go - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: pfnet-research - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build Snapshots - uses: goreleaser/goreleaser-action@v3 - with: - version: latest - args: release --snapshot --rm-dist --debug - # Mimic docker, docker_manifests artifacts in goreleaser here. - # because "goreleaser release --snapshot" does NOT publish any artifact - - name: Publish Snapshot Images - shell: bash - run: | - set -euo pipefail - IMAGES=($(jq -r '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json)) - for i in ${IMAGES[@]}; do - docker push $i - done - MANIFEST=$(jq '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json | jq -sr '.[0]' | sed -e "s|-[a-z0-9]\+$||g") - docker manifest create ${MANIFEST} ${IMAGES[@]} - docker manifest push ${MANIFEST} - MANIFEST_LATEST=$(jq '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json | jq -sr '.[0]' | sed -e "s|:.*$||g"):latest - docker manifest create ${MANIFEST_LATEST} ${IMAGES[@]} - docker manifest push ${MANIFEST_LATEST} diff --git a/.github/workflows/publish_dev_image.yaml b/.github/workflows/publish_dev_image.yaml new file mode 100644 index 0000000..d562d4b --- /dev/null +++ b/.github/workflows/publish_dev_image.yaml @@ -0,0 +1,47 @@ +name: Publish Dev Image + +on: + push: + branches: [ master ] + tags-ignore: [ "**" ] + paths-ignore: [ "**.md" ] + +jobs: + publish_dev_image: + name: Publish Dev Image + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Set up Go 1.x + uses: actions/setup-go@v3 + with: + go-version: ~1.16 + id: go + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: pfnet-research + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build Snapshots + uses: goreleaser/goreleaser-action@v3 + with: + version: latest + args: release --snapshot --rm-dist --debug + # Mimic docker, docker_manifests artifacts in goreleaser here. + # because "goreleaser release --snapshot" does NOT publish any artifact + - name: Publish Snapshot Images + shell: bash + run: | + set -euo pipefail + IMAGES=($(jq -r '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json)) + for i in ${IMAGES[@]}; do + docker push $i + done + MANIFEST=$(jq '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json | jq -sr '.[0]' | sed -e "s|-[a-z0-9]\+$||g") + docker manifest create ${MANIFEST} ${IMAGES[@]} + docker manifest push ${MANIFEST} + MANIFEST_LATEST=$(jq '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json | jq -sr '.[0]' | sed -e "s|:.*$||g"):latest + docker manifest create ${MANIFEST_LATEST} ${IMAGES[@]} + docker manifest push ${MANIFEST_LATEST}