diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea4f6dab5..734a295a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,8 @@ on: push: branches: - main - + tags: + - 'v*' name: Build docker image jobs: build-docker: @@ -13,17 +14,19 @@ jobs: - uses: docker/setup-buildx-action@v1 - - id: get-version - run: | - version=$(echo "${{ github.sha }}" | cut -c1-8) - echo "::set-output name=version::$version" - - id: meta uses: docker/metadata-action@v3 with: - images: | - ghcr.io/obolnetwork/charon/charon - tags: "latest,${{steps.get-version.outputs.version}}" + images: ghcr.io/obolnetwork/charon/charon + tags: | + # Tag "git short sha" on push to branch (main) + type=sha,event=branch + + # Tag "latest" on all events + type=raw,value=latest + + # Tag "tag ref" on tag push events + type=ref,event=tag - uses: docker/login-action@v1 with: @@ -38,5 +41,3 @@ jobs: push: true build-args: GITHUB_SHA=${{ github.sha }} tags: ${{ steps.meta.outputs.tags }} - - - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9cabe68e7..7de6ecf97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,34 +10,6 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: docker/setup-buildx-action@v1 - - - id: get-tag - run: | - tag=$(echo "${{ github.ref }}" | cut -d / -f 3) - echo "::set-output name=tag::$tag" - - - id: meta - uses: docker/metadata-action@v3 - with: - images: | - ghcr.io/obolnetwork/charon/charon - tags: "${{steps.get-tag.outputs.tag}}" - - - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.CONTAINER_REGISTRY_SECRET }} - - - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - build-args: GITHUB_SHA=${{ github.sha }} - tags: ${{ steps.meta.outputs.tags }} - - run: docker run ghcr.io/obolnetwork/charon/charon:${{steps.get-tag.outputs.tag}} charon run --help > cli-reference.txt - run: cat cli-reference.txt