This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
docs: update preview #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: notice | |
on: | |
push: | |
branches: [main] | |
paths: | |
- '.github/workflows/notice.yml' | |
- 'api/**' | |
- 'lib/**' | |
- 'index.js' | |
# pull_request: | |
# branches: [main] | |
jobs: | |
# notice-ui: | |
# runs-on: ${{ matrix.os }} | |
# env: | |
# # IMAGE_OWNER: dvgamerr | |
# # IMAGE_NAME: line-liff | |
# # PLATFORMS: linux/amd64,linux/arm64/v8 | |
# # IMAGE_FILE: notice-ui.Dockerfile | |
# # KUBE_DEPLOY: deploy/line-liff | |
# # KUBE_CONTAINER: line-liff | |
# # KUBE_NAMESPACE: notice-line | |
# # BASE_URL: https://notice.touno.io | |
# steps: | |
# - name: Checkout π | |
# uses: actions/checkout@master | |
# - name: Install Node.js | |
# uses: actions/setup-node@v4 | |
# with: | |
# node-version: 16 | |
# - name: Get yarn cache directory path π | |
# id: yarn-cache-dir-path | |
# run: echo "::set-output name=dir::$(yarn cache dir)" | |
# - name: Cache node_modules π¦ | |
# uses: actions/cache@v3.3.1 | |
# id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
# with: | |
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-yarn- | |
# - name: Install dependencies π¨π»βπ» | |
# run: pnpm i --prod | |
# # - name: Run linter π | |
# # run: yarn lint | |
# - name: Run Build βοΈ | |
# run: yarn build | |
# - name: Prepare π° | |
# id: prepare | |
# run: | | |
# echo ::set-output name=kube_deploy::${KUBE_DEPLOY} | |
# echo ::set-output name=kube_container::${KUBE_CONTAINER} | |
# echo ::set-output name=kube_namespace::${KUBE_NAMESPACE} | |
# VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# # Strip "v" prefix from tag name | |
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=v$(echo $VERSION | sed -e 's/^v//') | |
# # Use Docker `latest` tag convention | |
# [ "$VERSION" == "main" ] && VERSION=latest | |
# # Use Docker `test` tag convention | |
# [ "${{github.event_name}}" == "pull_request" ] && VERSION=test | |
# echo ::set-output name=docker_image::$IMAGE_OWNER/$IMAGE_NAME | |
# echo ::set-output name=version::${VERSION} | |
# echo ::set-output name=buildx_args::--platform $PLATFORMS \ | |
# --build-arg VERSION=${VERSION} \ | |
# --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ | |
# --build-arg VERSION=$VERSION \ | |
# --tag $IMAGE_OWNER/$IMAGE_NAME:$VERSION --file $IMAGE_FILE . | |
# - name: Set up Docker Buildx π | |
# uses: docker/setup-buildx-action@v2 | |
# - name: Docker Buildx βοΈ | |
# run: docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} | |
# - name: Notify After Build Fail π | |
# if: failure() && github.event_name != 'pull_request' | |
# run: curl -X PUT https://notice.touno.io/system/notice/%E2%9D%8C%20*%5BFailure%5D*%20Steps:%20Docker%20Buildx%20%E2%9A%99%EF%B8%8F | |
# - name: Login to DockerHub | |
# if: success() && github.event_name != 'pull_request' | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.DOCKER_TOKEN }} | |
# - name: Docker Push π | |
# if: success() && github.event_name != 'pull_request' | |
# run: docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} | |
# - name: Inspect π | |
# if: success() && github.event_name != 'pull_request' | |
# run: docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} | |
# # - name: Trigger deploy π | |
# # if: success() && github.event_name != 'pull_request' | |
# # uses: Consensys/kubernetes-action@1.1.0 | |
# # env: | |
# # KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
# # with: | |
# # args: set image ${{ steps.prepare.outputs.kube_deploy }} ${{ steps.prepare.outputs.kube_container }}=${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} -n ${{ steps.prepare.outputs.kube_namespace }} | |
# - name: Restart deployment π | |
# if: success() && github.event_name != 'pull_request' | |
# uses: Consensys/kubernetes-action@1.1.0 | |
# env: | |
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
# with: | |
# args: rollout restart ${{ steps.prepare.outputs.kube_deploy }} -n ${{ steps.prepare.outputs.kube_namespace }} | |
# - name: Status deployment π | |
# if: success() && github.event_name != 'pull_request' | |
# uses: Consensys/kubernetes-action@1.1.0 | |
# env: | |
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
# with: | |
# args: rollout status ${{ steps.prepare.outputs.kube_deploy }} -n ${{ steps.prepare.outputs.kube_namespace }} | |
notice: | |
runs-on: ubuntu-20.04 | |
env: | |
IMAGE_OWNER: dvgamerr | |
IMAGE_FILE: Dockerfile | |
IMAGE_NAME: notice | |
PLATFORMS: linux/amd64,linux/arm64 | |
outputs: | |
container_name: ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} | |
version: ${{ steps.prepare.outputs.version }} | |
steps: | |
- name: Checkout π | |
uses: actions/checkout@v4 | |
- name: Prepare π° | |
id: prepare | |
run: | | |
echo "kube_container=${KUBE_CONTAINER}" >> $GITHUB_OUTPUT | |
echo "kube_namespace=${KUBE_NAMESPACE}" >> $GITHUB_OUTPUT | |
echo "docker_image=${{github.actor}}/$IMAGE_NAME" >> $GITHUB_OUTPUT | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# # Strip "v" prefix from tag name | |
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=v$(echo $VERSION | sed -e 's/^v//') | |
# # Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=latest | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
echo "buildx_args=--platform $PLATFORMS \ | |
--build-arg VERSION=${VERSION} \ | |
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ | |
--build-arg VERSION=$VERSION \ | |
--tag ${{github.actor}}/$IMAGE_NAME:$VERSION --file $IMAGE_FILE ." >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx π | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Buildx βοΈ | |
run: docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} | |
# - name: Notify After Build Fail π | |
# if: failure() && github.event_name != 'pull_request' | |
# run: curl -X PUT https://notice.touno.io/system/notice/%E2%9D%8C%20*%5BFailure%5D*%20Steps:%20Docker%20Buildx%20%E2%9A%99%EF%B8%8F | |
- name: Login to DockerHub | |
if: success() && github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Docker Push π | |
run: docker buildx build --output "type=image,push=${{ github.event_name != 'pull_request' }}" ${{ steps.prepare.outputs.buildx_args }} | |
# - name: Trigger deploy π | |
# if: success() && github.event_name != 'pull_request' | |
# uses: Consensys/kubernetes-action@1.1.0 | |
# env: | |
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
# with: | |
# args: set image ${{ steps.prepare.outputs.kube_deploy }} ${{ steps.prepare.outputs.kube_container }}=${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} -n ${{ steps.prepare.outputs.kube_namespace }} | |
# - name: Restart deployment π | |
# if: success() && github.event_name != 'pull_request' | |
# uses: Consensys/kubernetes-action@1.1.0 | |
# env: | |
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
# with: | |
# args: rollout restart ${{ steps.prepare.outputs.kube_deploy }} -n ${{ steps.prepare.outputs.kube_namespace }} | |
# - name: Status deployment π | |
# if: success() && github.event_name != 'pull_request' | |
# uses: Consensys/kubernetes-action@1.1.0 | |
# env: | |
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
# with: | |
# args: rollout status ${{ steps.prepare.outputs.kube_deploy }} -n ${{ steps.prepare.outputs.kube_namespace }} | |
# notify-api: | |
# runs-on: ubuntu-20.04 | |
# needs: notice | |
# if: failure() && github.event_name != 'pull_request' | |
# steps: | |
# - name: Notify π | |
# run: curl -X PUT https://notice.touno.io/system/notice/%E2%9D%8C%20*%5BFailure%5D*%20Job:%20${{ github.job }}%20%E2%9A%99%EF%B8%8F | |
# notify-ui: | |
# runs-on: ubuntu-20.04 | |
# needs: notice-ui | |
# if: failure() && github.event_name != 'pull_request' | |
# steps: | |
# - name: Notify π | |
# run: curl -X PUT https://notice.touno.io/system/notice/%E2%9D%8C%20*%5BFailure%5D*%20Job:%20${{ github.job }}%20%E2%9A%99%EF%B8%8F |