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
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: MSIX Package
|
||||
path: ${{ env.Wap_Project_Directory }}\AppPackages
|
||||
|
||||
@@ -60,7 +60,7 @@ jobs:
|
||||
|
||||
# Upload SARIF file as an Artifact to download and view
|
||||
# - name: Upload SARIF as an Artifact
|
||||
# uses: actions/upload-artifact@v3
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: sarif-file
|
||||
# path: ${{ steps.run-analysis.outputs.sarif }}
|
||||
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
license: ${{ secrets.XANITIZER_LICENSE }}
|
||||
|
||||
# Archiving the findings list reports
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Xanitizer-Reports
|
||||
path: |
|
||||
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: .net-app
|
||||
path: ${{env.DOTNET_ROOT}}/myapp
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: .net-app
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
run: gradle build
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: java-app
|
||||
path: '${{ github.workspace }}/build/libs/*.jar'
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: java-app
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
run: mvn clean install
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: java-app
|
||||
path: '${{ github.workspace }}/target/*.jar'
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: java-app
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
npm run test --if-present
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: node-app
|
||||
path: .
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: node-app
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
run: composer validate --no-check-publish && composer install --prefer-dist --no-progress
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: php-app
|
||||
path: .
|
||||
@@ -86,7 +86,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: php-app
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
|
||||
|
||||
- name: Upload artifact for deployment jobs
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: python-app
|
||||
path: |
|
||||
@@ -73,7 +73,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: python-app
|
||||
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) {
|
||||
console.error("Unhandled error while syncing workflows", e);
|
||||
process.exitCode = 1;
|
||||
|
||||
Reference in New Issue
Block a user