Skip to content

Commit

Permalink
Merge branch 'main' into feat/experimental-sandbox-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
airslice committed May 12, 2023
2 parents db5ba1f + 57aa3c6 commit 8cb5b57
Show file tree
Hide file tree
Showing 60 changed files with 1,024 additions and 269 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/ci_collect_info.yml

This file was deleted.

79 changes: 0 additions & 79 deletions .github/workflows/ci_docker_build.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci_server.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ci-server
on:
push:
branches: [main, release/*]
branches: [main, release/*, release]
paths:
- server/**
pull_request:
Expand Down
118 changes: 113 additions & 5 deletions .github/workflows/ci_server_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,54 @@ on:
workflow_run:
workflows: [ci-server]
types: [completed]
branches: [main, release/*]
branches: [main, release/*, release]
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true

jobs:
info:
uses: reearth/reearth/.github/workflows/ci_collect_info.yml@main
name: Collect information
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'failure' && github.event.repository.full_name == 'reearth/reearth' && (startsWith(github.event.workflow_run.head_branch, 'release/') || github.event.workflow_run.head_branche == 'release' || github.event.workflow_run.head_branch == 'main' || !startsWith(github.event.head_commit.message, 'v')) }}
outputs:
sha_short: ${{ steps.info.outputs.sha_short }}
new_tag: ${{ steps.info.outputs.new_tag }}
new_tag_short: ${{ steps.info.outputs.new_tag_short }}
name: ${{ steps.info.outputs.name }}
steps:
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Get info
id: info
# The tag name should be retrieved lazily, as tagging may be delayed.
env:
BRANCH: ${{ github.event.workflow_run.head_branch }}
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "BRANCH=$BRANCH"
if [[ "$BRANCH" = "release" || "$BRANCH" = "release/"* ]]; then
TAG=$(git tag --points-at HEAD)
if [[ ! -z "$TAG" ]]; then
echo "::set-output name=new_tag::$TAG"
echo "::set-output name=new_tag_short::${TAG#v}"
else
echo "::set-output name=name::rc"
fi
else
echo "::set-output name=name::nightly"
fi
- name: Show info
env:
SHA_SHORT: ${{ steps.info.outputs.sha_short }}
NEW_TAG: ${{ steps.info.outputs.new_tag }}
NEW_TAG_SHORT: ${{ steps.info.outputs.new_tag_short }}
NAME: ${{ steps.info.outputs.name }}
run: echo "sha_short=$SHA_SHORT, new_tag=$NEW_TAG, new_tag_short=$NEW_TAG_SHORT, name=$NAME"

build-server:
name: Build and release server
Expand Down Expand Up @@ -67,8 +107,76 @@ jobs:
name: ${{ needs.info.outputs.new_tag }}
tag: ${{ needs.info.outputs.new_tag}}
bodyFile: CHANGELOG_latest.md
- name: Invoke ci-docker-build workflow

build-docker-image:
name: Build and push Docker image
runs-on: ubuntu-latest
needs: [info]
if: needs.info.outputs.name || needs.info.outputs.new_tag
env:
IMAGE_NAME: reearth/reearth
defaults:
run:
working-directory: server
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get options
id: options
env:
TAG: ${{ needs.info.outputs.new_tag_short }}
NAME: ${{ needs.info.outputs.name }}
SHA: ${{ needs.info.outputs.sha_short }}
run: |
if [[ -n $TAG ]]; then
PLATFORMS=linux/amd64,linux/arm64
VERSION=$TAG
TAGS=$IMAGE_NAME:$TAG
if [[ ! $TAG =~ '-' ]]; then
TAGS+=,${IMAGE_NAME}:${TAG%.*}
TAGS+=,${IMAGE_NAME}:${TAG%%.*}
TAGS+=,${IMAGE_NAME}:latest
fi
else
PLATFORMS=linux/amd64
VERSION=$SHA
TAGS=$IMAGE_NAME:$NAME
fi
echo "::set-output name=platforms::$PLATFORMS"
echo "::set-output name=version::$VERSION"
echo "::set-output name=tags::$TAGS"
- name: Fetch reearth-web release
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: reearth/reearth
version: tags/${{ needs.info.outputs.name || needs.info.outputs.tag }}
file: reearth-web_${{ needs.info.outputs.name || needs.info.outputs.tag }}.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
target: server/reearth-web.tar.gz
- name: Extract reearth/web
run: tar -xvf reearth-web.tar.gz; mv reearth-web web; ls
- name: Build and push docker image
uses: docker/build-push-action@v2
with:
context: server
platforms: ${{ steps.options.outputs.platforms }}
push: true
build-args: VERSION=${{ steps.options.outputs.version }}
tags: ${{ steps.options.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Invoke ci-deploy-server-nightly workflow
uses: benc-uk/workflow-dispatch@v1
if: needs.info.outputs.name == 'nightly'
with:
workflow: build-docker-image
token: ${{ secrets.GPT }}
workflow: deploy-server-nightly
token: ${{ secrets.GPT }}
2 changes: 1 addition & 1 deletion .github/workflows/ci_web.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ci-web
on:
push:
branches: [main, release/*]
branches: [main, release/*, release]
paths:
- web/**
pull_request:
Expand Down
Loading

0 comments on commit 8cb5b57

Please sign in to comment.