From 6175411f938b3e8a65d9d694aa761f61c0f29efd Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Mon, 10 Oct 2022 19:26:29 -0800 Subject: [PATCH] add publish workflow --- .github/workflows/partial-publish.yaml | 67 ++++++++++++++++++++++++++ .github/workflows/publish.yaml | 52 +++++++------------- 2 files changed, 85 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/partial-publish.yaml diff --git a/.github/workflows/partial-publish.yaml b/.github/workflows/partial-publish.yaml new file mode 100644 index 0000000..8c5f56f --- /dev/null +++ b/.github/workflows/partial-publish.yaml @@ -0,0 +1,67 @@ +name: Frontend / E2E + +on: + workflow_call: + inputs: + tag: + required: true + type: string + release: + required: false + type: boolean + default: false + +jobs: + publish: + name: "Publish Homebox" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.19 + + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v1 + with: + image: tonistiigi/binfmt:latest + platforms: all + + - name: install buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + install: true + + - name: login to container registry + run: docker login ghcr.io --username hay-kot --password $CR_PAT + env: + CR_PAT: ${{ secrets.CR_PAT }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + tags: user/app:latest + + - name: build nightly the image + if: ${{ inputs.release == false }} + run: | + docker build --push \ + --tag ghcr.io/hay-kot/homebox:{{ inputs.tag }} \ + --build-arg COMMIT=$(git rev-parse HEAD) \ + --build-arg BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ + --platform linux/amd64,linux/arm64,linux/arm/v7 . + + - name: build release tagged the image + if: ${{ inputs.release == true }} + run: | + docker build --push \ + --tag ghcr.io/hay-kot/homebox:nightly \ + --tag ghcr.io/hay-kot/homebox:latest \ + --tag ghcr.io/hay-kot/homebox:{{ inputs.tag }} \ + --build-arg COMMIT=$(git rev-parse HEAD) \ + --build-arg BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ + --platform linux/amd64,linux/arm64,linux/arm/v7 . diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 57f87c8..a42c5ca 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -4,6 +4,9 @@ on: push: branches: - main + release: + types: + - published env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} @@ -28,44 +31,25 @@ jobs: - uses: superfly/flyctl-actions/setup-flyctl@master - run: flyctl deploy --remote-only - publish: + publish-tag: + if: github.event_name == 'release' + name: "Publish Tag" + needs: + - backend-tests + - frontend-tests + uses: hay-kot/homebox/.github/workflows/partial-publish.yaml@main + with: + release: true + tag: ${{ github.event.release.tag_name }} + + publish-nightly: name: "Publish Nightly" needs: - backend-tests - frontend-tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.19 - - - name: Set up QEMU - id: qemu - uses: docker/setup-qemu-action@v1 - with: - image: tonistiigi/binfmt:latest - platforms: all - - - name: install buildx - id: buildx - uses: docker/setup-buildx-action@v1 - with: - install: true - - - name: login to container registry - run: docker login ghcr.io --username hay-kot --password $CR_PAT - env: - CR_PAT: ${{ secrets.CR_PAT }} - - - name: build the image - run: | - docker build --push \ - --tag ghcr.io/hay-kot/homebox:nightly \ - --build-arg COMMIT=$(git rev-parse HEAD) \ - --build-arg BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ - --platform linux/amd64,linux/arm64,linux/arm/v7 . + uses: hay-kot/homebox/.github/workflows/partial-publish.yaml@main + with: + tag: nightly deploy-docs: name: Deploy docs