From 095a0327d907521fe06268c335dee16cefaf7c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lobo=20Metal=C3=BArgico?= <43734867+LoboMetalurgico@users.noreply.github.com> Date: Tue, 2 Jan 2024 15:06:27 -0300 Subject: [PATCH] [ci] (fix): tagging and release on github --- .github/workflows/gitpublish.yml | 100 ------------------------------- .github/workflows/release.yml | 51 ++++++++++++++++ .github/workflows/tag.yml | 33 ++++++++++ 3 files changed, 84 insertions(+), 100 deletions(-) delete mode 100644 .github/workflows/gitpublish.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tag.yml diff --git a/.github/workflows/gitpublish.yml b/.github/workflows/gitpublish.yml deleted file mode 100644 index 238434a..0000000 --- a/.github/workflows/gitpublish.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Publish Tag and Release - -on: - workflow_run: - workflows: [Test] - types: [completed] - branches: [main] - -jobs: - tag: - name: Publish Tag - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: "Refresh tags" - id: refresh-tag - run: git fetch --tags --force - - - id: set_var - name: Get Version - run: echo ::set-output name=version::$(node -p "require('./package.json').version") - - - name: Push Tag - id: tag - uses: anothrNick/github-tag-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - WITH_V: true - CUSTOM_TAG: "v${{ steps.set_var.outputs.version }}" - dist: - needs: tag - name: Create Dist Files - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 20.x - - - name: Update npm - run: npm install -g npm@latest - - - name: Install Dependencies - run: npm ci - - - name: Generate Dist Files - run: npm run dist - release: - needs: dist - name: Publish Release - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: "Refresh tags" - id: tag - run: git fetch --tags --force - - - id: set_var - name: Get Version - run: echo ::set-output name=version::$(node -p "require('./package.json').version") - - - name: Echo Debug - run: echo "${{ steps.set_var.outputs.version }}" - - - name: Create GitHub release - uses: Roang-zero1/github-create-release-action@master - with: - prerelease_regex: ^v[0-9]\.[0-9]\.[0-9]\-ALPHA\.[0-9]+$ - created_tag: v${{ steps.set_var.outputs.version }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload release artifacts - uses: Roang-zero1/github-upload-release-artifacts-action@master - with: - args: "dist/arunacore.zip" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - publish-docker: - needs: release - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: Trigger Update Docker Image - uses: peter-evans/repository-dispatch@v2 - with: - token: ${{ secrets.BOT_SECRET }} - event-type: publish-docker-image - repository: ArunaBot/ArunaCore-Docker diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7aea3e3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +on: + push: + tags: + - "v*.*.*" + - "v*.*.*-*.*" + +jobs: + dist: + name: Create Dist and Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 20.x + + - name: "Refresh tags" + id: tag + run: git fetch --tags --force + + - id: set_var + name: "Get Version" + run: echo ::set-output name=version::$(node -p "require('./package.json').version") + + - name: Update npm + run: npm install -g npm@latest + + - name: Install Dependencies + run: npm ci + + - name: Generate Dist Files + run: npm run dist + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: dist/arunacore.zip + + publish-docker: + needs: [dist] + runs-on: ubuntu-latest + steps: + - name: Trigger Update Docker Image + uses: peter-evans/repository-dispatch@v2 + with: + token: ${{ secrets.BOT_SECRET }} + event-type: publish-docker-image + repository: ArunaBot/ArunaCore-Docker \ No newline at end of file diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000..5055818 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,33 @@ +name: Publish Tag and Release + +on: + workflow_run: + workflows: [Test] + types: [completed] + branches: [main] + +jobs: + tag: + name: Publish Tag + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: "Refresh tags" + id: refresh-tag + run: git fetch --tags --force + + - id: set_var + name: Get Version + run: echo ::set-output name=version::$(node -p "require('./package.json').version") + + - name: Push Tag + id: tag + uses: anothrNick/github-tag-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WITH_V: true + CUSTOM_TAG: "v${{ steps.set_var.outputs.version }}" +