From 6a04d48d00ddebef0d916bba30f3738b00753fdc Mon Sep 17 00:00:00 2001 From: Yuxing Deng Date: Fri, 18 Oct 2024 14:56:29 +0800 Subject: [PATCH] feat: move to GHA --- .drone.yml => .drone.bk.yml | 0 .github/workflows/push.yaml | 57 +++++++++++++++++++++++++++++++++++++ Dockerfile | 3 ++ 3 files changed, 60 insertions(+) rename .drone.yml => .drone.bk.yml (100%) create mode 100644 .github/workflows/push.yaml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.bk.yml similarity index 100% rename from .drone.yml rename to .drone.bk.yml diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml new file mode 100644 index 0000000..03c9e21 --- /dev/null +++ b/.github/workflows/push.yaml @@ -0,0 +1,57 @@ +name: Push to Master + +on: + push: + branches: + - main + - release-* + tags: + - 'v*.*.*' # Matches any tag that starts with 'v' and follows semantic versioning + - 'v*.*.*-rc*' + +permissions: + contents: write # This is required for actions/checkout + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/gallium + - name: build + run: | + yarn install + yarn run build + - name: checksum + if: startsWith(github.ref,'regs/tags/') + run: | + sha256sum dist/* > dist/sha256sum.txt + - name: Release + if: startsWith(github.ref,'regs/tags/') + uses: softprops/action-gh-release@v2 + with: + files: "dist/*" + - name: Login to Dockerhub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ vars.DOCKER_REPO || github.repository }} + tags: | + type=ref,event=tag + type=ref,event=branch + - name: Push dev container + uses: docker/build-push-action@v6 + with: + file: Dockerfile + context: . + labels: ${{ steps.meta.outputs.labels }} + tags: "${{ steps.meta.outputs.tags }}" + push: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..27788bd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:stable +COPY dist/* /usr/share/nginx/html +RUN rm /usr/share/nginx/html/index.html