From b20e2fa579b64e54354458a268793a738e4a658a Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Fri, 21 May 2021 13:45:06 +0200 Subject: [PATCH] Copy workflows. --- .github/workflows/dev.yml | 145 ++++++++++++++ .github/workflows/marketplace-aws.yml | 44 +++++ .github/workflows/marketplace-azure.yml | 44 +++++ .../workflows/marketplace-digitalocean.yml | 43 +++++ .github/workflows/marketplace-gcp.yml | 44 +++++ .github/workflows/marketplace-heroku.yml | 44 +++++ .github/workflows/marketplace-kubernetes.yml | 44 +++++ .github/workflows/marketplace-render.yml | 44 +++++ .github/workflows/marketplace-vultr.yml | 44 +++++ .github/workflows/release.yml | 180 ++++++++++++++++++ 10 files changed, 676 insertions(+) create mode 100644 .github/workflows/dev.yml create mode 100644 .github/workflows/marketplace-aws.yml create mode 100644 .github/workflows/marketplace-azure.yml create mode 100644 .github/workflows/marketplace-digitalocean.yml create mode 100644 .github/workflows/marketplace-gcp.yml create mode 100644 .github/workflows/marketplace-heroku.yml create mode 100644 .github/workflows/marketplace-kubernetes.yml create mode 100644 .github/workflows/marketplace-render.yml create mode 100644 .github/workflows/marketplace-vultr.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 000000000..d01d2096c --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,145 @@ +name: Dev +concurrency: dev + +on: + push: + branches: + - master + - 'release/*' + pull_request: + branches: + - master + - 'release/*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Calculate Version + env: + BUILD_NUMBER: ${{ github.run_number }} + run: | + echo "BUILD_NUMBER=$(($BUILD_NUMBER + 5967))" >> $GITHUB_ENV + + - name: Checkout + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: BUILD + uses: docker/build-push-action@v2 + with: + push: false + load: true + tags: squidex-tmp + build-args: "SQUIDEX__VERSION=4.0.0-dev-${{ env.BUILD_NUMBER }}" + + - name: Export Image + run: docker save squidex-tmp | gzip > squidex-tmp.tar.gz + + - name: Save Image to Cache + uses: actions/cache@v2 + with: + path: squidex-tmp.tar.gz + key: squidex-dev-image-${{ github.sha }} + + test: + needs: build + runs-on: ubuntu-latest + steps: + - name: Calculate Version + env: + BUILD_NUMBER: ${{ github.run_number }} + run: | + echo "BUILD_NUMBER=$(($BUILD_NUMBER + 5967))" >> $GITHUB_ENV + + - name: Checkout + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Get Image From Cache + uses: actions/cache@v2 + with: + path: squidex-tmp.tar.gz + key: squidex-dev-image-${{ github.sha }} + + - name: Load Image + run: docker load < squidex-tmp.tar.gz + + - name: Replace Image Name + uses: mikefarah/yq@v4.9.1 + with: + cmd: yq e '.services.squidex.image = "squidex-tmp"' -i backend/tests/docker-compose.yml + + - name: Start Test + run: docker-compose up -d + working-directory: backend/tests + + - name: Run Rest + uses: kohlerdominik/docker-run-action@v1.0.0 + with: + image: mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim + environment: | + CONFIG__WAIT=60 + CONFIG__SERVER__URL=http://localhost:8080 + default_network: host + options: --name test + volumes: ${{ github.workspace }}:/src + run: dotnet test /src/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj --filter Category!=NotAutomated + + - name: Cleanup Test + if: always() + run: docker-compose down + working-directory: backend/tests + + publish: + needs: test + runs-on: ubuntu-latest + steps: + - name: Calculate Version + env: + BUILD_NUMBER: ${{ github.run_number }} + run: | + echo "BUILD_NUMBER=$(($BUILD_NUMBER + 5967))" >> $GITHUB_ENV + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Login to Docker Hub + uses: docker/login-action@v1 + if: github.event_name != 'pull_request' + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Get Image From Cache + if: github.event_name != 'pull_request' + uses: actions/cache@v2 + with: + path: squidex-tmp.tar.gz + key: squidex-dev-image-${{ github.sha }} + + - name: Load Image + if: github.event_name != 'pull_request' + run: docker load < squidex-tmp.tar.gz + + - name: Rename Tags + if: github.event_name != 'pull_request' + run: | + docker tag squidex-tmp squidex/squidex:dev + docker tag squidex-tmp squidex/squidex:dev-${{ env.BUILD_NUMBER }} + + - name: Push Tags + if: github.event_name != 'pull_request' + run: | + docker push squidex/squidex:dev + docker push squidex/squidex:dev-${{ env.BUILD_NUMBER }} diff --git a/.github/workflows/marketplace-aws.yml b/.github/workflows/marketplace-aws.yml new file mode 100644 index 000000000..58f1b97fb --- /dev/null +++ b/.github/workflows/marketplace-aws.yml @@ -0,0 +1,44 @@ +name: Marketplace - AWS +concurrency: marketplace-aws + +on: + release: + types: [ released ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Validate Template + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: aws.pkr.hcl + working-directory: packer/ + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Build + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: aws.pkr.hcl + env: + PACKER_LOG: 1 + PKR_VAR_squidex_version: "${{ env.GITHUB_REF_SLUG }}" + AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}" + AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" + working-directory: packer/ diff --git a/.github/workflows/marketplace-azure.yml b/.github/workflows/marketplace-azure.yml new file mode 100644 index 000000000..885157103 --- /dev/null +++ b/.github/workflows/marketplace-azure.yml @@ -0,0 +1,44 @@ +name: Marketplace - Azure +concurrency: marketplace-azure + +on: + release: + types: [ released ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: azure.pkr.hcl + working-directory: packer/ + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: azure.pkr.hcl + env: + PACKER_LOG: 1 + PKR_VAR_squidex_version: "${{ env.GITHUB_REF_SLUG }}" + working-directory: packer/ diff --git a/.github/workflows/marketplace-digitalocean.yml b/.github/workflows/marketplace-digitalocean.yml new file mode 100644 index 000000000..70f59e9f5 --- /dev/null +++ b/.github/workflows/marketplace-digitalocean.yml @@ -0,0 +1,43 @@ +name: Marketplace - DigitalOcean +concurrency: marketplace-digitalocean + +on: + release: + types: [ released ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Validate Template + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: digitalocean.pkr.hcl + working-directory: packer/ + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Build + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: digitalocean.pkr.hcl + env: + PACKER_LOG: 1 + PKR_VAR_squidex_version: "${{ env.GITHUB_REF_SLUG }}" + DIGITALOCEAN_API_TOKEN: "${{ secrets.DIGITALOCEAN_API_TOKEN }}" + working-directory: packer/ diff --git a/.github/workflows/marketplace-gcp.yml b/.github/workflows/marketplace-gcp.yml new file mode 100644 index 000000000..1cc8e177c --- /dev/null +++ b/.github/workflows/marketplace-gcp.yml @@ -0,0 +1,44 @@ +name: Marketplace - GCP +concurrency: marketplace-gcp + +on: + release: + types: [ released ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: gcp.pkr.hcl + working-directory: packer/ + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: gcp.pkr.hcl + env: + PACKER_LOG: 1 + PKR_VAR_squidex_version: "${{ env.GITHUB_REF_SLUG }}" + working-directory: packer/ diff --git a/.github/workflows/marketplace-heroku.yml b/.github/workflows/marketplace-heroku.yml new file mode 100644 index 000000000..23b38ed17 --- /dev/null +++ b/.github/workflows/marketplace-heroku.yml @@ -0,0 +1,44 @@ +name: Marketplace - Heroku +concurrency: marketplace-heroku + +on: + release: + types: [ released ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: heroku.pkr.hcl + working-directory: packer/ + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: heroku.pkr.hcl + env: + PACKER_LOG: 1 + PKR_VAR_squidex_version: "${{ env.GITHUB_REF_SLUG }}" + working-directory: packer/ diff --git a/.github/workflows/marketplace-kubernetes.yml b/.github/workflows/marketplace-kubernetes.yml new file mode 100644 index 000000000..5a69fb164 --- /dev/null +++ b/.github/workflows/marketplace-kubernetes.yml @@ -0,0 +1,44 @@ +name: Marketplace - Kubernetes +concurrency: marketplace-kubernetes + +on: + release: + types: [ released ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: kubernetes.pkr.hcl + working-directory: packer/ + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: kubernetes.pkr.hcl + env: + PACKER_LOG: 1 + PKR_VAR_squidex_version: "${{ env.GITHUB_REF_SLUG }}" + working-directory: packer/ diff --git a/.github/workflows/marketplace-render.yml b/.github/workflows/marketplace-render.yml new file mode 100644 index 000000000..b5d6478a9 --- /dev/null +++ b/.github/workflows/marketplace-render.yml @@ -0,0 +1,44 @@ +name: Marketplace - Render +concurrency: marketplace-render + +on: + release: + types: [ released ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: render.pkr.hcl + working-directory: packer/ + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: render.pkr.hcl + env: + PACKER_LOG: 1 + PKR_VAR_squidex_version: "${{ env.GITHUB_REF_SLUG }}" + working-directory: packer/ diff --git a/.github/workflows/marketplace-vultr.yml b/.github/workflows/marketplace-vultr.yml new file mode 100644 index 000000000..a18f18cbf --- /dev/null +++ b/.github/workflows/marketplace-vultr.yml @@ -0,0 +1,44 @@ +name: Marketplace - Vultr +concurrency: marketplace-vultr + +on: + release: + types: [ released ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: vultr.pkr.hcl + working-directory: packer/ + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: vultr.pkr.hcl + env: + PACKER_LOG: 1 + PKR_VAR_squidex_version: "${{ env.GITHUB_REF_SLUG }}" + working-directory: packer/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..610854f1b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,180 @@ +name: Release +concurrency: release + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: BUILD + uses: docker/build-push-action@v2 + with: + push: false + load: true + tags: squidex-tmp + build-args: "SQUIDEX__VERSION=${{ env.GITHUB_REF_SLUG }}" + + - name: Export Image + run: docker save squidex-tmp | gzip > squidex-tmp.tar.gz + + - name: Save Image to Cache + uses: actions/cache@v2 + with: + path: squidex-tmp.tar.gz + key: squidex-release-image-${{ github.sha }} + + test: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Get Image From Cache + uses: actions/cache@v2 + with: + path: squidex-tmp.tar.gz + key: squidex-release-image-${{ github.sha }} + + - name: Load Image + run: docker load < squidex-tmp.tar.gz + + - name: Replace Image Name + uses: mikefarah/yq@v4.9.1 + with: + cmd: yq e '.services.squidex.image = "squidex-tmp"' -i backend/tests/docker-compose.yml + + - name: Start Test + run: docker-compose up -d + working-directory: backend/tests + + - name: Run Rest + uses: kohlerdominik/docker-run-action@v1.0.0 + with: + image: mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim + environment: | + CONFIG__WAIT=60 + CONFIG__SERVER__URL=http://localhost:8080 + default_network: host + options: --name test + volumes: ${{ github.workspace }}:/src + run: dotnet test /src/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj --filter Category!=NotAutomated + + - name: Cleanup Test + if: always() + run: docker-compose down + working-directory: backend/tests + + publish: + needs: test + runs-on: ubuntu-latest + steps: + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Get Major Version + id: version + uses: rishabhgupta/split-by@v1 + with: + string: '${{ env.GITHUB_REF_SLUG }}' + split-by: '.' + + - name: Get Image From Cache + uses: actions/cache@v2 + with: + path: squidex-tmp.tar.gz + key: squidex-release-image-${{ github.sha }} + + - name: Load Image + run: docker load < squidex-tmp.tar.gz + + - name: Rename Tags + run: | + docker tag squidex-tmp squidex/squidex:latest + docker tag squidex-tmp squidex/squidex:${{ env.GITHUB_REF_SLUG }} + docker tag squidex-tmp squidex/squidex:${{ steps.version.outputs._0 }} + + - name: Push Tags + run: | + docker push squidex/squidex:latest + docker push squidex/squidex:${{ env.GITHUB_REF_SLUG }} + docker push squidex/squidex:${{ steps.version.outputs._0 }} + + release: + needs: publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + + - name: Get Image From Cache + uses: actions/cache@v2 + with: + path: squidex-tmp.tar.gz + key: squidex-release-image-${{ github.sha }} + + - name: Load Image + run: docker load < squidex-tmp.tar.gz + + - name: Get Binaries + run: | + mkdir /build 2> /dev/null + docker create --name squidex-container squidex-tmp + docker cp squidex-container:/app/. /build + + - name: ZIP Binaries + run: | + mkdir /release 2> /dev/null + zip -r /release/binaries.zip . + working-directory: /build + + - name: Get Changelog Entry + id: changelog_reader + uses: mindsers/changelog-reader-action@v2 + with: + validation_depth: 10 + version: ${{ env.GITHUB_REF_SLUG }} + path: ./CHANGELOG.md + + - name: Publish Binaries + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifactErrorsFailBuild: true + artifact: "/release/binaries.zip" + body: ${{ steps.changelog_reader.outputs.changes }} + name: ${{ env.GITHUB_REF_SLUG }} + replaceArtifacts: true + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Cleanup Binaries + if: always() + run: docker rm squidex-container