diff --git a/.github/workflows/pre_release_builds.yml b/.github/workflows/pre_release_builds.yml new file mode 100644 index 00000000..e91d5439 --- /dev/null +++ b/.github/workflows/pre_release_builds.yml @@ -0,0 +1,28 @@ +name: Pre release builds + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' + +jobs: + build-image: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Extract tag + id: extract_tag + run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/v})" + - name: Print tag + run: echo "Running pre release build for ${{ steps.extract_tag.outputs.tag }}" + - name: Build kubernetes-tools image + run: make build-image BUILD_TAG=${{ steps.extract_tag.outputs.tag }} + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Push kubernetes-tools image + run: make push-image BUILD_TAG=${{ steps.extract_tag.outputs.tag }} diff --git a/.github/workflows/release_builds.yml b/.github/workflows/release_builds.yml index 9c9f4d04..e73102b4 100644 --- a/.github/workflows/release_builds.yml +++ b/.github/workflows/release_builds.yml @@ -4,9 +4,6 @@ on: push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+' jobs: build-image: @@ -17,9 +14,9 @@ jobs: id: extract_tag run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/v})" - name: Print tag - run: echo "Running dev build for ${{ steps.extract_tag.outputs.tag }}" + run: echo "Running release build for ${{ steps.extract_tag.outputs.tag }}" - name: Build kubernetes-tools image - run: make build-image BUILD_TAG=${{ steps.extract_tag.outputs.tag }} + run: make build-release-image BUILD_TAG=${{ steps.extract_tag.outputs.tag }} - name: Login to Docker Hub uses: docker/login-action@v1 with: @@ -27,5 +24,5 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: Push kubernetes-tools image run: make push-image BUILD_TAG=${{ steps.extract_tag.outputs.tag }} - - name: Push kubernetes-tools image build cache - run: make push-image-cache BUILD_TAG=${{ steps.extract_tag.outputs.tag }} + - name: Tag latest to point to most recent release + run: make tag-release-image-with-latest BUILD_TAG=${{ steps.extract_tag.outputs.tag }} diff --git a/Makefile b/Makefile index 6e3e9d70..e5dbbd80 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,15 @@ build-image: --tag $(IMAGE_NAME):$(BUILD_TAG) \ . +build-release-image: + DOCKER_BUILDKIT=1 docker build \ + --tag $(IMAGE_NAME):$(BUILD_TAG) \ + . + +tag-release-image-with-latest: + docker tag $(IMAGE_NAME):$(BUILD_TAG) $(REPO_URL):latest + docker push $(REPO_URL):latest + test-image: ./scripts/test-image.sh "$(IMAGE_NAME):$(BUILD_TAG)"