diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 725a256..8e0a989 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,3 +23,12 @@ jobs: args: release -f helper/.goreleaser.yml --rm-dist env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Publish docker + env: + host: 'ubuntu@en.dtm.pub' + dest: '/home/ubuntu' + run: | + echo "${{secrets.DEPLOY_KEY}}" > deploy_key + chmod 600 ./deploy_key + ssh -i deploy_key -o StrictHostKeyChecking=no ${{env.host}} 'cd ${{env.dest}}/dtm && sh helper/build-repo.sh ${{github.event.release.tag_name}}' diff --git a/helper/.goreleaser.yml b/helper/.goreleaser.yml index 1b6c66c..4e96e44 100644 --- a/helper/.goreleaser.yml +++ b/helper/.goreleaser.yml @@ -8,7 +8,6 @@ builds: - darwin goarch: - amd64 - - arm64 id: 'dtm' dir: . main: ./app/main.go diff --git a/helper/build-repo.sh b/helper/build-repo.sh index c511692..9182cb5 100755 --- a/helper/build-repo.sh +++ b/helper/build-repo.sh @@ -1,2 +1,8 @@ set -x -docker build -f helper/Dockerfile-release -t yedf/dtm:latest . && docker push yedf/dtm:latest \ No newline at end of file +if [ x$1 == x ]; then + echo please specify version + exit 1 +fi + +docker build -f helper/Dockerfile-release -t yedf/dtm:latest . && docker push yedf/dtm:latest +docker tag yedf/dtm:latest yedf/dtm:$1 && docker push yedf/dtm:$1 \ No newline at end of file