Sodium

Sodium

35M Downloads

Update Github workflows actions

mrjasonn opened this issue ยท 3 comments

commented

Is your feature request related to a problem? Please describe.
No.

Describe the solution you'd like
Please update the Github workflows actions because apparently they are outdated as of writing and probably when you are seeing this.

Describe alternatives you've considered
Not applicable

Additional context
No extra context

commented

Where are you seeing that they are outdated?

commented

Where are you seeing that they are outdated?

This is why @douira:

Sodium's build workflow:

name: gradle-ci

on: [ push, pull_request ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 17
      uses: actions/setup-java@v1
      with:
        java-version: 17
    - name: Cache/Uncache Sodium
      uses: actions/cache@v2
      with:
        path: |
          ~/.gradle/caches
          ~/.gradle/loom-cache
          ~/.gradle/wrapper
        key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
        restore-keys: |
          ${{ runner.os }}-gradle-
    - name: Build artifacts
      run: ./gradlew build
    - name: Extract current branch name
      shell: bash
      # bash pattern expansion to grab branch name without slashes
      run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
      id: ref
    - name: Upload build artifacts
      uses: actions/upload-artifact@v2
      with:
        name: sodium-artifacts-${{ steps.ref.outputs.branch }}
        # Filter built files to disregard -sources and -dev, and leave only the minecraft-compatible jars.
        path: build/libs/*[0-9].jar

My Mod's build workflow:

# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]

jobs:
  build:
    strategy:
      matrix:
        # Use these Java versions
        java: [
          17,    # Current Java LTS & minimum supported by Minecraft
        ]
        # and run on both Linux and Windows
        os: [windows-2022]
        # to run on Linux: os: [ubuntu-22.04] (if want artifacts from Linux, other changes needed)
    runs-on: ${{ matrix.os }}
    steps:
      - name: checkout repository
        uses: actions/checkout@v3
      - name: validate gradle wrapper
        uses: gradle/wrapper-validation-action@v1
      - name: setup jdk ${{ matrix.java }}
        uses: actions/setup-java@v3
        with:
          java-version: ${{ matrix.java }}
          distribution: 'oracle'
          # by default Github uses Microsoft one to restore change to 'microsoft'
      - name: make gradle wrapper executable
        if: ${{ runner.os != 'Windows' }}
        run: chmod +x ./gradlew
      - name: build
        run: ./gradlew build
      - name: capture build artifacts
        if: ${{ runner.os == 'Windows' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
        uses: actions/upload-artifact@v3
        with:
          name: Artifacts
          path: build/libs/

You can probably see the difference.

commented

I don't really know what you're asking for here, but we updated the workflows to be slightly more modern.