Skip to content

Commit

Permalink
fix: jobs data passing
Browse files Browse the repository at this point in the history
  • Loading branch information
patte committed Sep 2, 2024
1 parent 32b9f8c commit e98ffbb
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 19 deletions.
57 changes: 39 additions & 18 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,29 @@ env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}

jobs:
init:
runs-on: ubuntu-latest
steps:
- name: Get latest release tag and check for new release
id: check_release
run: |
RELEASE_TAG=$(curl -s https://api.github.com/repos/get-convex/convex-backend/releases/latest | grep "tag_name" | cut -d\" -f4)
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
PREVIOUS_TAG=$(docker inspect ghcr.io/${{ github.repository }}:latest --format '{{ index .Config.Labels "org.opencontainers.image.version" }}' || echo "none")
if [ -z "$PREVIOUS_TAG" ]; then
echo "No previous image found. Proceeding with the build of release: $RELEASE_TAG."
elif [ "$RELEASE_TAG" == "$PREVIOUS_TAG" ]; then
echo "No new release detected. Exiting."
exit 0
else
echo "New release detected: $RELEASE_TAG"
fi
outputs:
release_tag: ${{ env.RELEASE_TAG }}
build:
needs: init
strategy:
fail-fast: false
matrix:
Expand All @@ -25,6 +47,14 @@ jobs:
cache-to:
runs-on: ${{ matrix.runner }}
steps:
- name: check for new release
run: |
if [ -z "${{ needs.init.outputs.release_tag }}" ]; then
echo "No release tag found. Exiting."
exit 0
fi
echo "RELEASE_TAG=${{ needs.init.outputs.release_tag }}" >> $GITHUB_ENV
- name: Prepare
run: |
platform=${{ matrix.platform }}
Expand All @@ -33,23 +63,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get latest release tag and check for new release
id: check_release
run: |
RELEASE_TAG=$(curl -s https://api.github.com/repos/get-convex/convex-backend/releases/latest | grep "tag_name" | cut -d\" -f4)
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
PREVIOUS_TAG=$(docker inspect ghcr.io/${{ github.repository }}:latest --format '{{ index .Config.Labels "org.opencontainers.image.version" }}' || echo "none")
if [ -z "$PREVIOUS_TAG" ]; then
echo "No previous image found. Proceeding with the build of release: $RELEASE_TAG."
elif [ "$RELEASE_TAG" == "$PREVIOUS_TAG" ]; then
echo "No new release detected. Exiting."
exit 0
else
echo "New release detected: $RELEASE_TAG"
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand Down Expand Up @@ -90,8 +103,16 @@ jobs:

merge:
runs-on: ubuntu-latest
needs: build
needs: [init, build]
steps:
- name: check for new release
run: |
if [ -z "${{ needs.init.outputs.release_tag }}" ]; then
echo "No release tag found. Exiting."
exit 0
fi
echo "RELEASE_TAG=${{ needs.init.outputs.release_tag }}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is an inofficial docker image for [convex-backend](https://github.com/get-c
The Dockerfile clones the repo from github at the specified release tag. A github action builds the image and pushes it to ghcr.io.

> [!WARNING] Sporadic updates
> Building the `linux/arm64` image does exceed the timeout of the free github runner (6h). A local runner is used to build the image (~45min on MacBook Air M2, with bad internet). Until a better solution is found, there will only be sporadic updates of the image, as keeping the local runner running is obviously not an option.
> Building the `linux/arm64` image does exceed the timeout of the free github runner (6h). A local runner is used to build the image (~16min on MacBook Air M2, with bad internet). Until a better solution is found, there will only be sporadic updates of the image, as keeping the local runner running is obviously not an option.
> `amd64` builds are done on the default runner.
## Build
Expand Down

0 comments on commit e98ffbb

Please sign in to comment.