Skip to content
This repository was archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
添加ci自动打包发布
Browse files Browse the repository at this point in the history
  • Loading branch information
AoEiuV020 committed May 15, 2024
1 parent f69b2da commit 6822084
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI
env:
TZ: Asia/Shanghai
on:
workflow_dispatch:
push:
paths-ignore:
- '**/README.md'
- '.github/workflows/*'
- '!.github/workflows/ci.yml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: init custom env
run: |
BUILD_NAME="${GITHUB_REPOSITORY#*/}"
BUILD_VERSION="$(date +'%Y%m%d%H%M%S')"
BUILD_NAME_WITH_VERSION="$BUILD_NAME-$BUILD_VERSION"
echo BUILD_NAME="$BUILD_NAME" >> .custom_env
echo BUILD_VERSION="$BUILD_VERSION" >> .custom_env
echo BUILD_NAME_WITH_VERSION="$BUILD_NAME_WITH_VERSION" >> .custom_env
if test ! -z "${{ secrets.DOCKERHUB_USERNAME }}" && test ! -z "${{ secrets.DOCKERHUB_TOKEN }}"
then
echo publish='true' >> $GITHUB_ENV
fi
cat .custom_env
cat .custom_env >> $GITHUB_ENV
- name: Login to DockerHub
if: ${{ env.publish == 'true' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: docker build
run: ./script/build.sh
- name: docker push
if: ${{ env.publish == 'true' }}
run: ./script/push.sh $BUILD_VERSION
env:
DOCKER_ID: ${{ secrets.DOCKERHUB_USERNAME }}
6 changes: 3 additions & 3 deletions script/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set -e
script_dir=$(cd $(dirname $0);pwd)
ROOT=$(dirname $script_dir)
IMAGE_NAME=ps4broadcast
CONTAINER_NAME=ps4b
DOCKER_ID=aoeiuv020
IMAGE_NAME="${IMAGE_NAME:-ps4broadcast}"
CONTAINER_NAME="${CONTAINER_NAME:-ps4b}"
DOCKER_ID="${DOCKER_ID:-aoeiuv020}"

0 comments on commit 6822084

Please sign in to comment.