From b63f4d68350b427948d19f170083658283a13464 Mon Sep 17 00:00:00 2001 From: Hyperbola Date: Fri, 24 Jun 2022 14:25:12 +0800 Subject: [PATCH] add workflow --- .github/workflows/build.yml | 42 +++++++++++++++++++++++++++++++++++++ .vscode/settings.json | 5 +++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .vscode/settings.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..599bdce --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,42 @@ +name: Build + +on: + workflow_dispatch: ~ + push: + branches: + - main + paths: + - src/** + +jobs: + build: + name: Build and push image onto dockerhub and ghcr + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install pnpm and dependencies + uses: pnpm/action-setup@v2.2.2 + with: + run_install: true + - name: Build project + run: pnpm build + - uses: wdzeng/image@v1 + with: + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }} + tag: + name: Add tags to repository + needs: + - build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - id: version + uses: wdzeng/version@v1 + with: + prefix: v + - name: Add tags + run: | + git tag -f ${{ steps.version.outputs.version }} main && \ + git push -f origin ${{ steps.version.outputs.version }} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2598660 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "yaml.schemas": { + "https://json.schemastore.org/github-workflow.json": "file:///home/hyperbola/repo/pinkoi-coins-bot/.github/workflows/build.yml" + } +} \ No newline at end of file