diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 000000000..85be8d67f --- /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..985d04f7e --- /dev/null +++ b/.github/workflows/marketplace-aws.yml @@ -0,0 +1,41 @@ +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: Fix Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: fix + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: packer/aws.pkr.hcl + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: packer/aws.pkr.hcl + env: + PACKER_LOG: 1 diff --git a/.github/workflows/marketplace-azure.yml b/.github/workflows/marketplace-azure.yml new file mode 100644 index 000000000..abd68677c --- /dev/null +++ b/.github/workflows/marketplace-azure.yml @@ -0,0 +1,41 @@ +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: Fix Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: fix + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: packer/azure.pkr.hcl + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: packer/azure.pkr.hcl + env: + PACKER_LOG: 1 diff --git a/.github/workflows/marketplace-digitalocean.yml b/.github/workflows/marketplace-digitalocean.yml new file mode 100644 index 000000000..673275a05 --- /dev/null +++ b/.github/workflows/marketplace-digitalocean.yml @@ -0,0 +1,41 @@ +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: Fix Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: fix + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: packer/digitalocean.pkr.hcl + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: packer/digitalocean.pkr.hcl + env: + PACKER_LOG: 1 diff --git a/.github/workflows/marketplace-gcp.yml b/.github/workflows/marketplace-gcp.yml new file mode 100644 index 000000000..e585ec7d5 --- /dev/null +++ b/.github/workflows/marketplace-gcp.yml @@ -0,0 +1,41 @@ +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: Fix Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: fix + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: packer/gcp.pkr.hcl + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: packer/gcp.pkr.hcl + env: + PACKER_LOG: 1 diff --git a/.github/workflows/marketplace-heroku.yml b/.github/workflows/marketplace-heroku.yml new file mode 100644 index 000000000..f2cae0d94 --- /dev/null +++ b/.github/workflows/marketplace-heroku.yml @@ -0,0 +1,41 @@ +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: Fix Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: fix + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: packer/heroku.pkr.hcl + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: packer/heroku.pkr.hcl + env: + PACKER_LOG: 1 diff --git a/.github/workflows/marketplace-kubernetes.yml b/.github/workflows/marketplace-kubernetes.yml new file mode 100644 index 000000000..30ab0c8c3 --- /dev/null +++ b/.github/workflows/marketplace-kubernetes.yml @@ -0,0 +1,41 @@ +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: Fix Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: fix + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: packer/kubernetes.pkr.hcl + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: packer/kubernetes.pkr.hcl + env: + PACKER_LOG: 1 diff --git a/.github/workflows/marketplace-render.yml b/.github/workflows/marketplace-render.yml new file mode 100644 index 000000000..c8c4a1004 --- /dev/null +++ b/.github/workflows/marketplace-render.yml @@ -0,0 +1,41 @@ +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: Fix Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: fix + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: packer/render.pkr.hcl + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: packer/render.pkr.hcl + env: + PACKER_LOG: 1 diff --git a/.github/workflows/marketplace-vultr.yml b/.github/workflows/marketplace-vultr.yml new file mode 100644 index 000000000..743448e3f --- /dev/null +++ b/.github/workflows/marketplace-vultr.yml @@ -0,0 +1,41 @@ +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: Fix Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: fix + - name: Validate Template + if: false + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: packer/vultr.pkr.hcl + + publish: + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build + if: false + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: packer/vultr.pkr.hcl + env: + PACKER_LOG: 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..067efa753 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,182 @@ +name: Release +concurrency: release + +on: + push: + branches: + - "!*" + 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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4855045e2..9d30e6df0 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ launchSettings.json /frontend/app-config/localhost-key.pem /frontend/app-config/localhost.pem +.idea