commit e734ec1ff6b046ac435a5141b58a8aa4a37db8f4 Author: xRain Date: Tue Aug 22 11:40:28 2023 +0800 test diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..d1c9afb --- /dev/null +++ b/action.yml @@ -0,0 +1,21 @@ +# action.yml +name: 'build docker image and push to code' +description: 'build docker image and push to simcu code' +runs: + using: 'composite' + steps: + - uses: docker://node:18 + with: + entrypoint: 'bash -c' + args: + - npm install + - npm run build -- --outputPath=dist + + - shell: sh + run: | + echo "FROM nginx:alpine" > Dockerfile + echo "COPY dist /usr/share/nginx/html" >> Dockerfile + echo "WORKDIR /usr/share/nginx/html/" >> Dockerfile + docker build -t ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} . + docker login ${{env.DOCKER_REGISTRY}} -u ${{env.DOCKER_USER}} -p ${{env.DOCKER_PASS}} + docker push ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} \ No newline at end of file