Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Automate publishing and update versioning #257

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci-landing-page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Landing Page CI

on:
push:
branches:
- main
paths:
- "node/common/**"
- "node/landing-page/**"
- "dockerfiles/landing-page/**"
pull_request:
branches:
- main
paths:
- "node/common/**"
- "node/landing-page/**"
- "dockerfiles/landing-page/**"
release:
types:
- published

jobs:
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 }}
24 changes: 24 additions & 0 deletions .github/workflows/ci-monitor-theia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Monitor Theia extension CI

on:
push:
branches:
- main
paths:
- "node/monitor-theia/**"
pull_request:
branches:
- main
paths:
- "node/monitor-theia/**"
release:
types:
- published

jobs:
call-reusable-npm-workflow:
uses: ./.github/workflows/reusable-npm.yml
with:
package_workspace: monitor-theia
secrets:
npm-token: ${{ secrets.NPM_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/ci-node-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Common node package CI

on:
push:
branches:
- main
paths:
- "node/common/**"
pull_request:
branches:
- main
paths:
- "node/common/**"
release:
types:
- published

jobs:
call-reusable-npm-workflow:
uses: ./.github/workflows/reusable-npm.yml
with:
package_workspace: common
secrets:
npm-token: ${{ secrets.NPM_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/ci-operator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Operator CI

on:
push:
branches:
- main
paths:
- "java/common/**"
- "java/operator/**"
- "dockerfiles/operator/**"
pull_request:
branches:
- main
paths:
- "java/common/**"
- "java/operator/**"
- "dockerfiles/operator/**"
release:
types:
- published

jobs:
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 }}
31 changes: 31 additions & 0 deletions .github/workflows/ci-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Service CI

on:
push:
branches:
- main
paths:
- "java/common/**"
- "java/service/**"
- "dockerfiles/service/**"
pull_request:
branches:
- main
paths:
- "java/common/**"
- "java/service/**"
- "dockerfiles/service/**"
release:
types:
- published

jobs:
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 }}
31 changes: 31 additions & 0 deletions .github/workflows/ci-try-now-page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Try Now Page CI

on:
push:
branches:
- main
paths:
- "node/common/**"
- "node/try-now-page/**"
- "dockerfiles/try-now-page/**"
pull_request:
branches:
- main
paths:
- "node/common/**"
- "node/try-now-page/**"
- "dockerfiles/try-now-page/**"
release:
types:
- published

jobs:
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 }}
27 changes: 27 additions & 0 deletions .github/workflows/ci-wondershaper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Wondershaper CI

on:
push:
branches:
- main
paths:
- "dockerfiles/wondershaper/**"
pull_request:
branches:
- main
paths:
- "dockerfiles/wondershaper/**"
release:
types:
- published

jobs:
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 }}
18 changes: 0 additions & 18 deletions .github/workflows/docker-landing-page.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/docker-operator.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/docker-try-now-page.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/docker-wondershaper.yml

This file was deleted.

101 changes: 101 additions & 0 deletions .github/workflows/reusable-docker.yml
Original file line number Diff line number Diff line change
@@ -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_OUTPUT

- 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_OUTPUT
echo "version_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}" >> $GITHUB_OUTPUT

- 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_OUTPUT
echo "latest_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:latest" >> $GITHUB_OUTPUT

- 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 }}
Loading