Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update starter workflows to use the latest artifact actions #2726

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion code-scanning/msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion code-scanning/xanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions deployments/azure-webapps-dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions deployments/azure-webapps-java-jar-gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions deployments/azure-webapps-java-jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions deployments/azure-webapps-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions deployments/azure-webapps-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions deployments/azure-webapps-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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: .
Expand Down
21 changes: 21 additions & 0 deletions script/sync-ghes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading