Skip to content

Commit

Permalink
Merge pull request #54 from stack-wuh/feat-ci
Browse files Browse the repository at this point in the history
fix: (ci) 测试自动重启容器脚本错误
  • Loading branch information
stack-wuh committed Dec 12, 2021
2 parents 7df3a69 + 0e8fc4b commit da7567e
Showing 1 changed file with 65 additions and 50 deletions.
115 changes: 65 additions & 50 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,61 +11,76 @@ on:
types: [published]

jobs:
push_to_docker:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.release_head_tags.outputs.tags }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
# push_to_docker:
# name: Push Docker image to Docker Hub
# runs-on: ubuntu-latest
# outputs:
# tags: ${{ steps.release_head_tags.outputs.tags }}
# steps:
# - name: Check out the repo
# uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Log in to Docker Hub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: shadowu/wuh.site
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v3
# with:
# images: shadowu/wuh.site

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v2
# with:
# context: .
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

- name: Output
id: release_head_tags
run: echo "::set-output name=tags::${{ steps.meta.outputs.tags }}"
# - name: Output
# id: release_head_tags
# run: echo "::set-output name=tags::${{ steps.meta.outputs.tags }}"

build_container:
name: Build Container
# build_container:
# name: Build Container
# runs-on: ubuntu-latest
# needs: [push_to_docker]
# env:
# TAG_REF: ${{ github.ref }}
# GITHUB_CONTEXT: ${{ toJson(github) }}
# steps:
# - name: executing remote ssh commands using password
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USERNAME }}
# key: ${{ secrets.KEY }}
# port: ${{ secrets.PORT }}
# script: |
# docker ps -a
# tag=`echo ${TAG_REF}|awk -F/ '{print $3}'`
# echo "[github bot] version:" ${tag}
# echo ${TAG_REF}
# echo "$GITHUB_CONTEXT"
# cd /home/next-web-app/frontend
# ./bin/clear-docker.sh
# ./bin/build-container.sh ${tag} hello world

test_build:
name: test build
runs-on: ubuntu-latest
needs: [push_to_docker]
env:
TAG_REF: ${{ github.ref }}
GITHUB_CONTEXT: ${{ toJson(github) }}
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
- uses: actions/checkout@v2
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
docker ps -a
tag=`echo ${TAG_REF}|awk -F/ '{print $3}'`
echo "[github bot] version:" ${tag}
echo ${TAG_REF}
echo "$GITHUB_CONTEXT"
cd /home/next-web-app/frontend
./bin/clear-docker.sh
./bin/build-container.sh ${tag} hello world
fetch-depth: 0
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: latest
- name: logger
run: |
echo "version.tag:" ${{ steps.previoustag.outputs.tag }}

2 comments on commit da7567e

@vercel
Copy link

@vercel vercel bot commented on da7567e Dec 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployment failed with the following error:

The most recent charge for your active payment method has failed. Please update it here: https://vercel.com/teams/163m/settings/billing.

@vercel
Copy link

@vercel vercel bot commented on da7567e Dec 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.