|
1 | | -name: Java CI |
| 1 | +name: "Build and Deploy" |
2 | 2 | on: |
3 | 3 | release: |
4 | | - types: [published,prereleased] |
| 4 | + types: [published,edited] |
5 | 5 | jobs: |
6 | 6 | build: |
7 | | - # Setup the OS |
| 7 | + # Set up the OS |
8 | 8 | runs-on: ubuntu-latest |
9 | | - permissions: |
10 | | - contents: read |
11 | | - packages: write |
12 | 9 | env: |
| 10 | + # Nexus credentials and GitHub token |
13 | 11 | NEXUS_USERNAME: '${{ secrets.NEXUS_USERNAME }}' |
14 | 12 | NEXUS_PASSWORD: '${{ secrets.NEXUS_PASSWORD }}' |
15 | 13 | GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' |
| 14 | + # Set environment |
| 15 | + env: 'prod' |
16 | 16 | steps: |
17 | | - # Checkout the code |
18 | | - - name: Ceckout the Code |
19 | | - uses: actions/checkout@v2 |
20 | | - # Install java and maven |
21 | | - - name: Set up JDK 1.8 |
22 | | - uses: actions/setup-java@v2 |
23 | | - with: |
24 | | - distribution: adopt |
25 | | - java-version: 8 |
26 | | - # Validate Gradle Wrapper |
27 | | - - name: Validate Gradle Wrapper |
28 | | - uses: gradle/wrapper-validation-action@v1 |
29 | | - # Test and deploy |
30 | | - - name: Make gradle executable |
31 | | - run: chmod +x gradlew |
32 | | - - name: Test and Deploy with Gradle |
33 | | - run: ./gradlew clean test shadow publish |
| 17 | + # Checkout the Code |
| 18 | + - name: Checkout Code |
| 19 | + uses: actions/checkout@v2 |
| 20 | + # Set up git hashes environment variables |
| 21 | + - name: Git Hashes |
| 22 | + |
| 23 | + # Set up version from tag environment variables |
| 24 | + - name: Version from Tag Action |
| 25 | + |
| 26 | + with: |
| 27 | + remove-first-character: 'v' |
| 28 | + # Set up the JDK |
| 29 | + - name: Set up JDK 8 |
| 30 | + uses: actions/setup-java@v2 |
| 31 | + with: |
| 32 | + distribution: adopt |
| 33 | + java-version: 8 |
| 34 | + # Validate Gradle Wrapper |
| 35 | + - name: Validate Gradle Wrapper |
| 36 | + uses: gradle/wrapper-validation-action@v1 |
| 37 | + # Make gradle executable |
| 38 | + - name: Make gradle executable |
| 39 | + run: chmod +x gradlew |
| 40 | + # Clean, Test, Publish and Build (in that order to save the artifact to the action) |
| 41 | + - name: Test, Deploy and Build with Gradle |
| 42 | + run: ./gradlew clean test publish shadow |
34 | 43 | # Now we store the artifact in the action |
35 | | - - name: Create & Copy artifact |
36 | | - run: mkdir -p ./artifacts && cp build/libs/SuperCoreAPI.jar ./artifacts/ |
37 | | - - name: Upload the artifact |
38 | | - uses: actions/upload-artifact@v2 |
39 | | - with: |
40 | | - name: SuperCoreAPI |
41 | | - path: ./artifacts/SuperCoreAPI.jar |
42 | | - - name: Deploy Javadoc |
43 | | - |
44 | | - with: |
45 | | - branch: gh-pages |
46 | | - folder: build/docs/javadoc |
47 | | - clean: true |
48 | | - |
49 | | - |
| 44 | + - name: Upload the artifact |
| 45 | + uses: actions/upload-artifact@v2 |
| 46 | + with: |
| 47 | + name: SuperCoreAPI |
| 48 | + path: ./build/libs/SuperCoreAPI.jar |
| 49 | + # Now we deploy the documents to GitHub pages |
| 50 | + - name: Deploy Javadoc |
| 51 | + |
| 52 | + with: |
| 53 | + branch: gh-pages |
| 54 | + folder: build/docs/javadoc |
| 55 | + clean: true |
0 commit comments