Skip to content

Commit

Permalink
Merge pull request #26 from Cairry/master
Browse files Browse the repository at this point in the history
add workflows ci
  • Loading branch information
Cairry authored Apr 23, 2024
2 parents 0bdea62 + cce363f commit 63d572d
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: 1. Set env
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
echo "SHORT_SHA=$(echo ${GITHUB_SHA:0:4})" >> $GITHUB_ENV
echo "DATE=$(TZ=Asia/Shanghai date +%Y-%m-%d.%H-%M-%S)" >> $GITHUB_ENV
- name: 2. Build Docker image
run: |
docker build -t cairry/watchalert:$BRANCH_NAME.$DATE.$SHORT_SHA .
docker tag cairry/watchalert:$BRANCH_NAME.$DATE.$SHORT_SHA cairry/watchalert:latest
- name: 3. Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: 4. Push Docker image to Docker Hub
run: |
docker push cairry/watchalert:latest
docker push cairry/watchalert:$BRANCH_NAME.$DATE.$SHORT_SHA
61 changes: 61 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 63d572d

Please sign in to comment.