zip - Download and unzip file from URL with Github Action - Stack Overflow

时间: 2025-01-06 admin 业界

I'm setting up a github testing action that requires a plugin to be run. I want it to download and unzip the zip file from this link. I've tried looking for a way to do this and haven't found a way.

This is my current code:


on:
  - push
  - pull_request

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v2
      - name: Set up JDK 17
        uses: actions/setup-java@v1
        with:
          java-version: '17'
          distribution: 'oracle'
      - name: Grant execute permission for gradlew
        run: chmod +x gradlew
      - name: Build with Gradle
        run: ./gradlew build
      - name: Upload artifacts
        uses: actions/upload-artifact@master
        with:
          path: build/libs/*.jar
  test:
    runs-on: ubuntu-latest
    needs: [ build ]
    steps:
        - name: Checkout repo
          uses: actions/checkout@v2
        - name: Download artifacts
          uses: actions/download-artifact@v4
          with:
            path: extra-plugins/
            merge-multiple: true
        - name: Run tests
          uses: SkriptLang/[email protected]
          with:
            test_script_directory: src/test/scripts
            skript_repo_ref: dev/patch
            extra_plugins_directory: extra-plugins/

This is to run a Minecraft Server Instance. I need it to put the jar file within the zip located at the path archive/dist/target/ into the extra plugins directory shown in the last line of code.