From 763341882f8eea8e8351895cbd3fb046d49a4615 Mon Sep 17 00:00:00 2001 From: krispyking24 <77263183+krispyking24@users.noreply.github.com> Date: Mon, 5 Aug 2024 21:25:44 +1000 Subject: [PATCH] Update auto release.yml Update main.yml Update main.yml Update main.yml Create main.yml Update auto release.yml --- .github/workflows/auto release.yml | 38 ++++++++++++++++++++---------- .github/workflows/main.yml | 26 ++++++++++++++++++++ 2 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/auto release.yml b/.github/workflows/auto release.yml index 7ef1f17..bf277b3 100644 --- a/.github/workflows/auto release.yml +++ b/.github/workflows/auto release.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - + - name: Set up Node.js uses: actions/setup-node@v3 with: @@ -26,24 +26,36 @@ jobs: - name: Install unzip run: sudo apt-get update && sudo apt-get install -y unzip - - name: Find and Extract .jar from ZIP - run: | - # Find the ZIP file - ZIP_FILE=$(find . -type f -name "*.zip") - echo "Found ZIP file: $ZIP_FILE" + - name: Download Artifact + uses: actions/download-artifact@v3 + with: + name: Artifacts + path: ./build/libs - # Extract the .jar file from the ZIP - unzip -j "$ZIP_FILE" "*.jar" -d ./extracted + - name: Unzip Artifact + run: | + echo "Unzipping artifact..." + unzip -d ./extracted ./build/libs/Artifacts.zip ls -l ./extracted + - name: Create and Push Tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + TAG_NAME="v${{ github.run_number }}" + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git tag $TAG_NAME + git push origin $TAG_NAME + - name: Create GitHub Release id: create_release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + tag_name: ${{ steps.create_and_push_tag.outputs.tag }} + release_name: "Release ${{ steps.create_and_push_tag.outputs.tag }}" body: | Changes in this release: - Add your changes here @@ -53,9 +65,9 @@ jobs: - name: Upload Release Asset uses: actions/upload-release-asset@v1 env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./extracted/*.jar asset_name: $(basename ./extracted/*.jar) - asset_content_type: application/java-archive + asset_content_type: application/java-archive \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..bef6870 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,26 @@ +# This is a basic workflow to help you get started with the GitHub Auto-Release on Commit Action. + +name: AutoRelease + +on: + push: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + release: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - uses: actions/checkout@v2 + - uses: CupOfTea696/gh-action-auto-release@v1.0.2 + with: + title: "Release: $version" + tag: "v$semver" + draft: false + regex: "/^Release: #{semver}$/i" + env: + GITHUB_TOKEN: ${{ secrets.GB_TOKEN }}