Update starter workflows to use the latest artifact actions (#2726)
* Update starter workflows to use the latest artifact actions * Ensure incompatible artifact actions aren't synced to GHES
This commit is contained in:
@@ -109,7 +109,7 @@ jobs:
|
|||||||
|
|
||||||
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
|
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
|
||||||
- name: Upload build artifacts
|
- name: Upload build artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: MSIX Package
|
name: MSIX Package
|
||||||
path: ${{ env.Wap_Project_Directory }}\AppPackages
|
path: ${{ env.Wap_Project_Directory }}\AppPackages
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
|
|
||||||
# Upload SARIF file as an Artifact to download and view
|
# Upload SARIF file as an Artifact to download and view
|
||||||
# - name: Upload SARIF as an Artifact
|
# - name: Upload SARIF as an Artifact
|
||||||
# uses: actions/upload-artifact@v3
|
# uses: actions/upload-artifact@v4
|
||||||
# with:
|
# with:
|
||||||
# name: sarif-file
|
# name: sarif-file
|
||||||
# path: ${{ steps.run-analysis.outputs.sarif }}
|
# path: ${{ steps.run-analysis.outputs.sarif }}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ jobs:
|
|||||||
license: ${{ secrets.XANITIZER_LICENSE }}
|
license: ${{ secrets.XANITIZER_LICENSE }}
|
||||||
|
|
||||||
# Archiving the findings list reports
|
# Archiving the findings list reports
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Xanitizer-Reports
|
name: Xanitizer-Reports
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ jobs:
|
|||||||
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
|
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
|
||||||
|
|
||||||
- name: Upload artifact for deployment job
|
- name: Upload artifact for deployment job
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: .net-app
|
name: .net-app
|
||||||
path: ${{env.DOTNET_ROOT}}/myapp
|
path: ${{env.DOTNET_ROOT}}/myapp
|
||||||
@@ -75,7 +75,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact from build job
|
- name: Download artifact from build job
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: .net-app
|
name: .net-app
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
run: gradle build
|
run: gradle build
|
||||||
|
|
||||||
- name: Upload artifact for deployment job
|
- name: Upload artifact for deployment job
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: java-app
|
name: java-app
|
||||||
path: '${{ github.workspace }}/build/libs/*.jar'
|
path: '${{ github.workspace }}/build/libs/*.jar'
|
||||||
@@ -66,7 +66,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact from build job
|
- name: Download artifact from build job
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: java-app
|
name: java-app
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
run: mvn clean install
|
run: mvn clean install
|
||||||
|
|
||||||
- name: Upload artifact for deployment job
|
- name: Upload artifact for deployment job
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: java-app
|
name: java-app
|
||||||
path: '${{ github.workspace }}/target/*.jar'
|
path: '${{ github.workspace }}/target/*.jar'
|
||||||
@@ -66,7 +66,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact from build job
|
- name: Download artifact from build job
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: java-app
|
name: java-app
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
npm run test --if-present
|
npm run test --if-present
|
||||||
|
|
||||||
- name: Upload artifact for deployment job
|
- name: Upload artifact for deployment job
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: node-app
|
name: node-app
|
||||||
path: .
|
path: .
|
||||||
@@ -65,7 +65,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact from build job
|
- name: Download artifact from build job
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: node-app
|
name: node-app
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ jobs:
|
|||||||
run: composer validate --no-check-publish && composer install --prefer-dist --no-progress
|
run: composer validate --no-check-publish && composer install --prefer-dist --no-progress
|
||||||
|
|
||||||
- name: Upload artifact for deployment job
|
- name: Upload artifact for deployment job
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: php-app
|
name: php-app
|
||||||
path: .
|
path: .
|
||||||
@@ -86,7 +86,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact from build job
|
- name: Download artifact from build job
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: php-app
|
name: php-app
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
|
# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
|
||||||
|
|
||||||
- name: Upload artifact for deployment jobs
|
- name: Upload artifact for deployment jobs
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: python-app
|
name: python-app
|
||||||
path: |
|
path: |
|
||||||
@@ -73,7 +73,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact from build job
|
- name: Download artifact from build job
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: python-app
|
name: python-app
|
||||||
path: .
|
path: .
|
||||||
|
|||||||
@@ -196,6 +196,27 @@ async function checkWorkflow(
|
|||||||
})
|
})
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// The v4 versions of upload and download artifact are not yet supported on GHES
|
||||||
|
console.group("Updating all compatible workflows to use v3 of the artifact actions");
|
||||||
|
for (const workflow of result.compatibleWorkflows) {
|
||||||
|
const path = join(workflow.folder, `${workflow.id}.yml`);
|
||||||
|
console.log(`Updating ${path}`);
|
||||||
|
const contents = await fs.readFile(path, "utf8");
|
||||||
|
|
||||||
|
if (contents.includes("actions/upload-artifact@v4") || contents.includes("actions/download-artifact@v4")) {
|
||||||
|
console.log("Found v4 artifact actions, updating to v3");
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let updatedContents = contents.replace(/actions\/upload-artifact@v4/g, "actions/upload-artifact@v3");
|
||||||
|
updatedContents = updatedContents.replace(/actions\/download-artifact@v4/g, "actions/download-artifact@v3");
|
||||||
|
|
||||||
|
await fs.writeFile(path, updatedContents);
|
||||||
|
}
|
||||||
|
console.groupEnd();
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Unhandled error while syncing workflows", e);
|
console.error("Unhandled error while syncing workflows", e);
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user