diff --git a/.github/workflows/ci-landing-page.yml b/.github/workflows/ci-landing-page.yml index e2bfd9b3..74e5eedd 100644 --- a/.github/workflows/ci-landing-page.yml +++ b/.github/workflows/ci-landing-page.yml @@ -19,94 +19,13 @@ on: types: - published -env: - DOCKER_ORG: theiacloud - DOCKER_IMAGE: theia-cloud-landing-page - DOCKER_FILE: dockerfiles/landing-page/Dockerfile.local - VERSION: 0.9.0-next - jobs: - prepare: - runs-on: ubuntu-latest - outputs: - version_tag: ${{ steps.get_tags.outputs.version_tag }} - latest_tag: ${{ steps.get_tags.outputs.latest_tag }} - sha_tag: ${{ steps.get_tags.outputs.sha_tag }} - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Get Short SHA - id: get_sha - run: echo "sha=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV - - - name: Get docker - id: get_tags - run: | - echo "sha_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}.${{ steps.get_sha.outputs.sha }}" >> $GITHUB_ENV - echo "version_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}" >> $GITHUB_ENV - echo "latest_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:latest" >> $GITHUB_ENV - - build: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build the Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - publish-next: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and SHA tag for main pushes of next versions (This avoids duplicate pushes for release commits on main) - - name: Push version and SHA tag - if: endsWith(env.VERSION, '-next') - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.sha_tag }} - docker push ${{ needs.prepare.outputs.sha_tag }} - - publish-latest: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'release' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and latest tag for releases (version should be valid semver) - - name: Push version and latest tag - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.latest_tag }} - docker push ${{ needs.prepare.outputs.latest_tag }} + call-reusable-docker-workflow: + uses: ./.github/workflows/reusable-docker.yml + with: + docker_org: theiacloud + docker_image: theia-cloud-landing-page + docker_file: dockerfiles/landing-page/Dockerfile.local + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/ci-operator.yml b/.github/workflows/ci-operator.yml index 6bf43f90..ee3db825 100644 --- a/.github/workflows/ci-operator.yml +++ b/.github/workflows/ci-operator.yml @@ -19,94 +19,13 @@ on: types: - published -env: - DOCKER_ORG: theiacloud - DOCKER_IMAGE: theia-cloud-operator - DOCKER_FILE: dockerfiles/operator/Dockerfile - VERSION: 0.9.0-next - jobs: - prepare: - runs-on: ubuntu-latest - outputs: - version_tag: ${{ steps.get_tags.outputs.version_tag }} - latest_tag: ${{ steps.get_tags.outputs.latest_tag }} - sha_tag: ${{ steps.get_tags.outputs.sha_tag }} - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Get Short SHA - id: get_sha - run: echo "sha=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV - - - name: Get docker - id: get_tags - run: | - echo "sha_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}.${{ steps.get_sha.outputs.sha }}" >> $GITHUB_ENV - echo "version_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}" >> $GITHUB_ENV - echo "latest_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:latest" >> $GITHUB_ENV - - build: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build the Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - publish-next: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and SHA tag for main pushes of next versions (This avoids duplicate pushes for release commits on main) - - name: Push version and SHA tag - if: endsWith(env.VERSION, '-next') - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.sha_tag }} - docker push ${{ needs.prepare.outputs.sha_tag }} - - publish-latest: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'release' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and latest tag for releases (version should be valid semver) - - name: Push version and latest tag - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.latest_tag }} - docker push ${{ needs.prepare.outputs.latest_tag }} + call-reusable-docker-workflow: + uses: ./.github/workflows/reusable-docker.yml + with: + docker_org: theiacloud + docker_image: theia-cloud-operator + docker_file: dockerfiles/operator/Dockerfile + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/ci-service.yml b/.github/workflows/ci-service.yml index 2eefcfac..819138a1 100644 --- a/.github/workflows/ci-service.yml +++ b/.github/workflows/ci-service.yml @@ -19,94 +19,13 @@ on: types: - published -env: - DOCKER_ORG: theiacloud - DOCKER_IMAGE: theia-cloud-service - DOCKER_FILE: dockerfiles/service/Dockerfile - VERSION: 0.9.0-next - jobs: - prepare: - runs-on: ubuntu-latest - outputs: - version_tag: ${{ steps.get_tags.outputs.version_tag }} - latest_tag: ${{ steps.get_tags.outputs.latest_tag }} - sha_tag: ${{ steps.get_tags.outputs.sha_tag }} - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Get Short SHA - id: get_sha - run: echo "sha=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV - - - name: Get docker - id: get_tags - run: | - echo "sha_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}.${{ steps.get_sha.outputs.sha }}" >> $GITHUB_ENV - echo "version_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}" >> $GITHUB_ENV - echo "latest_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:latest" >> $GITHUB_ENV - - build: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build the Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - publish-next: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and SHA tag for main pushes of next versions (This avoids duplicate pushes for release commits on main) - - name: Push version and SHA tag - if: endsWith(env.VERSION, '-next') - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.sha_tag }} - docker push ${{ needs.prepare.outputs.sha_tag }} - - publish-latest: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'release' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and latest tag for releases (version should be valid semver) - - name: Push version and latest tag - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.latest_tag }} - docker push ${{ needs.prepare.outputs.latest_tag }} + call-reusable-docker-workflow: + uses: ./.github/workflows/reusable-docker.yml + with: + docker_org: theiacloud + docker_image: theia-cloud-service + docker_file: dockerfiles/service/Dockerfile + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/ci-try-now-page.yml b/.github/workflows/ci-try-now-page.yml index b26ca630..46705a86 100644 --- a/.github/workflows/ci-try-now-page.yml +++ b/.github/workflows/ci-try-now-page.yml @@ -19,94 +19,13 @@ on: types: - published -env: - DOCKER_ORG: theiacloud - DOCKER_IMAGE: theia-cloud-try-now-page - DOCKER_FILE: dockerfiles/try-now-page/Dockerfile - VERSION: 0.9.0-next - jobs: - prepare: - runs-on: ubuntu-latest - outputs: - version_tag: ${{ steps.get_tags.outputs.version_tag }} - latest_tag: ${{ steps.get_tags.outputs.latest_tag }} - sha_tag: ${{ steps.get_tags.outputs.sha_tag }} - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Get Short SHA - id: get_sha - run: echo "sha=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV - - - name: Get docker - id: get_tags - run: | - echo "sha_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}.${{ steps.get_sha.outputs.sha }}" >> $GITHUB_ENV - echo "version_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}" >> $GITHUB_ENV - echo "latest_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:latest" >> $GITHUB_ENV - - build: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build the Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - publish-next: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and SHA tag for main pushes of next versions (This avoids duplicate pushes for release commits on main) - - name: Push version and SHA tag - if: endsWith(env.VERSION, '-next') - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.sha_tag }} - docker push ${{ needs.prepare.outputs.sha_tag }} - - publish-latest: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'release' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and latest tag for releases (version should be valid semver) - - name: Push version and latest tag - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.latest_tag }} - docker push ${{ needs.prepare.outputs.latest_tag }} + call-reusable-docker-workflow: + uses: ./.github/workflows/reusable-docker.yml + with: + docker_org: theiacloud + docker_image: theia-cloud-try-now-page + docker_file: dockerfiles/try-now-page/Dockerfile + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/ci-wondershaper.yml b/.github/workflows/ci-wondershaper.yml index f0b4f64c..4364f064 100644 --- a/.github/workflows/ci-wondershaper.yml +++ b/.github/workflows/ci-wondershaper.yml @@ -15,94 +15,13 @@ on: types: - published -env: - DOCKER_ORG: theiacloud - DOCKER_IMAGE: theia-cloud-wondershaper - DOCKER_FILE: dockerfiles/wondershaper/Dockerfile - VERSION: 0.9.0-next - jobs: - prepare: - runs-on: ubuntu-latest - outputs: - version_tag: ${{ steps.get_tags.outputs.version_tag }} - latest_tag: ${{ steps.get_tags.outputs.latest_tag }} - sha_tag: ${{ steps.get_tags.outputs.sha_tag }} - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Get Short SHA - id: get_sha - run: echo "sha=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV - - - name: Get docker - id: get_tags - run: | - echo "sha_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}.${{ steps.get_sha.outputs.sha }}" >> $GITHUB_ENV - echo "version_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}" >> $GITHUB_ENV - echo "latest_tag=${{ env.DOCKER_ORG }}/${{ env.DOCKER_IMAGE }}:latest" >> $GITHUB_ENV - - build: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build the Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - publish-next: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and SHA tag for main pushes of next versions (This avoids duplicate pushes for release commits on main) - - name: Push version and SHA tag - if: endsWith(env.VERSION, '-next') - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.sha_tag }} - docker push ${{ needs.prepare.outputs.sha_tag }} - - publish-latest: - needs: prepare - runs-on: ubuntu-latest - if: github.event_name == 'release' - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Build Docker image - run: docker build -t ${{ needs.prepare.outputs.version_tag }} -f ${{ env.DOCKER_FILE }} . - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push version and latest tag for releases (version should be valid semver) - - name: Push version and latest tag - run: | - docker push ${{ needs.prepare.outputs.version_tag }} - docker tag ${{ needs.prepare.outputs.version_tag }} ${{ needs.prepare.outputs.latest_tag }} - docker push ${{ needs.prepare.outputs.latest_tag }} + call-reusable-docker-workflow: + uses: ./.github/workflows/reusable-docker.yml + with: + docker_org: theiacloud + docker_image: theia-cloud-wondershaper + docker_file: dockerfiles/wondershaper/Dockerfile + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/resuable-docker.yml b/.github/workflows/resuable-docker.yml new file mode 100644 index 00000000..4e8f077d --- /dev/null +++ b/.github/workflows/resuable-docker.yml @@ -0,0 +1,101 @@ +name: Reusable workflow for docker images + +on: + workflow_call: + inputs: + docker_org: + required: true + type: string + docker_image: + required: true + type: string + docker_file: + required: true + type: string + secrets: + dockerhub_username: + required: true + dockerhub_token: + required: true + +env: + VERSION: 0.9.0-next + +jobs: + build: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Create docker tags + id: get_tags + run: | + echo "version_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}" >> $GITHUB_ENV + + - name: Build the Docker image + run: | + docker build -t ${{ steps.get_tags.outputs.version_tag }} -f ${{ inputs.docker_file }} . + + publish-next: + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Create docker tags + id: get_tags + run: | + echo "sha_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}.$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV + echo "version_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}" >> $GITHUB_ENV + + - name: Build Docker image + run: docker build -t ${{ steps.get_tags.outputs.version_tag }} -f ${{ inputs.docker_file }} . + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.dockerhub_username }} + password: ${{ secrets.dockerhub_token }} + + # Push version and SHA tag for main pushes of next versions (This avoids duplicate pushes for release commits on main) + - name: Push version and SHA tag + if: endsWith(env.VERSION, '-next') + run: | + docker push ${{ steps.get_tags.outputs.version_tag }} + docker tag ${{ steps.get_tags.outputs.version_tag }} ${{ steps.get_tags.outputs.sha_tag }} + docker push ${{ steps.get_tags.outputs.sha_tag }} + + publish-latest: + runs-on: ubuntu-latest + if: github.event_name == 'release' + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Create docker tags + id: get_tags + run: | + echo "version_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}" >> $GITHUB_ENV + echo "latest_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:latest" >> $GITHUB_ENV + + - name: Build Docker image + run: docker build -t ${{ steps.get_tags.outputs.version_tag }} -f ${{ inputs.docker_file }} . + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.dockerhub_username }} + password: ${{ secrets.dockerhub_token }} + + # Push version and latest tag for releases (version should be valid semver) + - name: Push version and latest tag + run: | + docker push ${{ steps.get_tags.outputs.version_tag }} + docker tag ${{ steps.get_tags.outputs.version_tag }} ${{ steps.get_tags.outputs.latest_tag }} + docker push ${{ steps.get_tags.outputs.latest_tag }}