name: Visitenbuch CI on: push: pull_request: jobs: test: runs-on: cimaster-latest services: postgres: image: postgres env: POSTGRES_DB: "test" POSTGRES_PASSWORD: "1234" oidc: image: thetadev256/oidc-mock-server env: CLIENT_ID: visitenbuch CLIENT_SECRET: supersecret CLIENT_REDIRECT_URIS: http://localhost:4173/auth/callback/keycloak CLIENT_LOGOUT_REDIRECT_URIS: http://localhost:4173/login?noAuto=1 ISSUER_HOST: oidc:3000 env: DATABASE_URL: "postgresql://postgres:1234@postgres:5432/test?schema=public" TEST_DATABASE_URL: "postgresql://postgres:1234@postgres:5432/test?schema=public" KEYCLOAK_ISSUER: http://oidc:3000 KEYCLOAK_LOGOUT: http://oidc:3000/session/end steps: - name: ๐Ÿ‘๏ธ Checkout repository uses: actions/checkout@v4 - name: Test run: | curl http://oidc:3000/.well-known/openid-configuration || sleep 1000 # - name: ๐Ÿ“ฆ pnpm install # run: | # pnpm install # cp .env.test .env # - name: ๐Ÿง lint # run: | # npm run check # npm run lint # - name: ๐Ÿงช Unit test # run: npm run test:unit # - name: ๐Ÿงช Integration test # run: | # npx prisma migrate reset --force # npm run test:integration # - name: ๐Ÿ‘จโ€๐Ÿ”ฌ E2E test # run: | # npx playwright install --with-deps # npm run build # npm run test:e2e release: runs-on: cimaster-latest needs: test if: ${{ startsWith(github.ref, 'refs/tags/v') }} # if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} steps: - name: ๐Ÿ‘๏ธ Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: ๐Ÿ“ฆ pnpm install run: pnpm install - name: โš’๏ธ Build web application run: npm run build - name: ๐Ÿ‹ Build docker image uses: https://code.thetadev.de/ThetaDev/action-kaniko@v1 with: image: thetadev256/visitenbuch username: thetadev256 password: ${{ secrets.DOCKER_TOKEN }} tag: ${{ github.ref_name }} tag_with_latest: ${{ startsWith(github.ref, 'refs/tags/v') }} platforms: "linux/amd64,linux/arm64" - name: Get changelog if: ${{ startsWith(github.ref, 'refs/tags/v') }} run: | { echo 'CHANGELOG<> "$GITHUB_ENV" - name: ๐ŸŽ‰ Publish release if: ${{ startsWith(github.ref, 'refs/tags/v') }} uses: https://gitea.com/actions/release-action@main with: title: "Visitenbuch ${{ github.ref_name }}" body: "${{ env.CHANGELOG }}" - name: ๐Ÿš€ Deploy to server if: ${{ startsWith(github.ref, 'refs/tags/v') }} run: | curl -s -H "Authorization: Bearer ${{ secrets.THETADEV_DE_WATCHTOWER_TOKEN }}" https://watchtower.thetadev.de/v1/update