From 3f8a17f502ebfaf3ce0bb72fc8edfd552c59ab6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=BF=98=E5=88=9D=E5=BF=83?= <1624717079@qq.com> Date: Wed, 24 Aug 2022 10:24:58 +0800 Subject: [PATCH] 111 --- Dockerfile | 19 ++++++++++++------- action.yml | 15 ++++++++++++--- entrypoint.sh | 14 ++++++++++++-- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 073d3ae..c9c70de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,17 @@ +# Container image that runs your code FROM alpine:3.12 -RUN apk --no-cache add wget curl bash - -RUN wget -O upx.tar.gz http://collection.b0.upaiyun.com/softwares/upx/upx_0.3.6_linux_x86_64.tar.gz \ - && tar -zxf upx.tar.gz \ - && mv upx /usr/local/bin/upx \ - && chmod +x /usr/local/bin/upx - +# Copies your code file from your action repository to the filesystem path `/` of the container COPY entrypoint.sh /entrypoint.sh +# Make sure to make you entrypoint.sh file executable: +RUN chmod +x entrypoint.sh + +RUN apk update \ + && apk add --no-cache wget \ + && wget -O upx.tar.gz http://collection.b0.upaiyun.com/softwares/upx/upx_0.3.6_linux_x86_64.tar.gz \ + && tar -zxf upx.tar.gz \ + && mv upx /usr/local/bin/upx \ + && chmod +x /usr/local/bin/upx +# Code file to execute when the docker container starts up (`entrypoint.sh`) ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml index 63fcad5..bee3fca 100644 --- a/action.yml +++ b/action.yml @@ -2,15 +2,24 @@ name: 'upyun-upx-action' author: 'YaoKun ' description: 'Deploy your files to upyun using upyun-upx.' inputs: - UP_BUCKET: + up_bucket: description: '服务名' required: true - UP_OPERATOR: + up_operator: description: '操作员' required: true - UP_OPERATOR_PASSWORD: + up_operator_password: description: '操作员密码' required: true + local_path: + description: 'will put all file under this path' + required: true + default: ./public/* + remote_path: + description: 'files will copy to under remote_path' + required: true + default: / + runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 44f7ed3..91e07a6 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,13 @@ -#!/bin/bash +#!/bin/sh -l -upx login ${{ secrets.UP_BUCKET }} ${{ secrets.UP_OPERATOR }} ${{ secrets.UP_OPERATOR_PASSWORD }} +#set -e at the top of your script will make the script exit with an error whenever an error occurs (and is not explicitly handled) +set -eu + +upx login $1 $2 $3 + +upx sync $4 $5 --delete + +upx logout + +echo 'Deploy Success' +exit 0 \ No newline at end of file