I have the following steps to copy files to artifact and publish artifact:
- name: copy FA function arm templates
run: Copy 'Service/Project/Hosts/FA/Infrastructure/' 'upload/functions_arm_templates/FA/Infrastructure'
shell: powershell
- name: copy FB function arm templates
run: Copy 'Service/Project/Hosts/FB/Infrastructure/' 'upload/functions_arm_templates/FB/Infrastructure'
shell: powershell
- name: publish artifact
uses: actions/upload-artifact#v2
with:
name: ${{github.run_number}}
path: upload/**
The Build succeeded however after downloading the artifact, I don't see a folder named functions_arm_templates. What am I missing?
You are only copying the folder without its contents.
Use copy 'Service/Project/Hosts/FA/Infrastructure/' 'upload/functions_arm_templates/FA/Infrastructure/' -recurse to copy the folder with its contents.
Related
I was trying to build my soultion using msbuild and using follow ing workflow
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: ./genshincheat.sln
# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release
permissions:
contents: read
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout#v2
with:
submodules: true
- uses: actions/setup-dotnet#v1
- name: Build
run: dotnet build
- name: Run tests
run: dotnet test
The problem comes when the msbuild command runs :-
Build FAILED.
D:\a\genshin-cheat\genshin-cheat\injector\injector.vcxproj : warning NU1503: Skipping restore for project 'D:\a\genshin-cheat\genshin-cheat\injector\injector.vcxproj'. The project file may be invalid or missing targets required for restore. [D:\a\genshin-cheat\genshin-cheat\genshincheat.sln]
D:\a\genshin-cheat\genshin-cheat\cheat-base\cheat-base.vcxproj : warning NU1503: Skipping restore for project 'D:\a\genshin-cheat\genshin-cheat\cheat-base\cheat-base.vcxproj'. The project file may be invalid or missing targets required for restore. [D:\a\genshin-cheat\genshin-cheat\genshincheat.sln]
D:\a\genshin-cheat\genshin-cheat\cheat-library\cheat-library.vcxproj : warning NU1503: Skipping restore for project 'D:\a\genshin-cheat\genshin-cheat\cheat-library\cheat-library.vcxproj'. The project file may be invalid or missing targets required for restore. [D:\a\genshin-cheat\genshin-cheat\genshincheat.sln]
C:\Program Files\dotnet\sdk\6.0.202\NuGet.targets(130,5): warning : Unable to find a project to restore! [D:\a\genshin-cheat\genshin-cheat\genshincheat.sln]
D:\a\genshin-cheat\genshin-cheat\cheat-base\cheat-base.vcxproj(25,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
D:\a\genshin-cheat\genshin-cheat\cheat-library\cheat-library.vcxproj(757,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
D:\a\genshin-cheat\genshin-cheat\injector\injector.vcxproj(39,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
4 Warning(s)
3 Error(s)
Time Elapsed 00:00:12.01
Error: Process completed with exit code 1.
I suppose this is because of the non - existence of the file mentioned
my repo has a solution file and with it 3 subfolders. in the error "cheat-base\cheat-base.vcxproj(25,3)" was missing so i suppose one of the subfolders i.e. cheat-base isnt being cloned. any solutions?
adding recursive instead of true to subfolder solved this
Here is my idea: build a static web page template, over time add .md files to a /posts directory and build a CI job to convert the .md files to html (with the showdownjs/showdown package).
Is there a need to install the package on every push? Seems like a waste, but uploading /node-modules is incorrect as well. Is there a way to install the package once, and let github action just work with it (run the md to html converter on newly added files)?
You have 2 options:
Recommened: Use caching action to cache dependencies for your project - using a hash from package-lock.json as a key to make sure it rebuild when depenendencies has changed:
- name: Cache node modules
uses: actions/cache#v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
run: npm install
Push your node_modules to Git repository so it's checkout together with everything else
For optimising a need to run your converted you can use this action:
https://github.com/tj-actions/changed-files/
and detect if any files were modified at certain path
I have a solution in Visual Studio consisting of multiple report projects, and using Azure Pipelines to deploy the reports to my report server. This pipeline has served me faithfully for years, but my goal is to simplify it a bit.
Running MSBuild for the solution generates a directory structure like this:
- root
- Project A
- bin
- Release
- Report1.rdl
- Report2.rdl
- Project B
- bin
- Release
- Report3.rdl
- Report4.rdl
Question: how can I use either the Copy Files task in my pipeline or a subsequent PowerShell task to produce a slightly flattened structure like this, where the bin and Release folder for each project is removed?:
- root
- Project A
- Report1.rdl
- Report2.rdl
- Project B
- Report3.rdl
- Report4.rdl
Here is an outline of my current pipeline configuration:
- Build solution
- MSBuild arguments: none
- Configuration: $(BuildConfiguration)
- Copy files
- Source folder: $(build.sourcesdirectory)
- Contents: **\bin\$(BuildConfiguration)\**\*.rdl
- Target folder: $(Build.ArtifactStagingDirectory)
- Publish artifact
- Path to publish: $(Build.ArtifactStagingDirectory)
You can use something like that:
- Build solution
- MSBuild arguments: none
- Configuration: $(BuildConfiguration)
- Copy files
- Source folder: $(build.sourcesdirectory)
- Contents: **\Project A\bin\$(BuildConfiguration)\*.rdl
- Target folder: $(Build.ArtifactStagingDirectory)\Project A
- Flatten Folders: True
- Copy files
- Source folder: $(build.sourcesdirectory)
- Contents: **\Project B\bin\$(BuildConfiguration)\*.rdl
- Target folder: $(Build.ArtifactStagingDirectory)\Project B
- Flatten Folders: True
- Publish artifact
- Path to publish: $(Build.ArtifactStagingDirectory)
The Flatten folders option here:
OR
- Build solution
- MSBuild arguments: none
- Configuration: $(BuildConfiguration)
- Copy files
- Source folder: $(build.sourcesdirectory)\Solution Folder\Project A\bin\$(BuildConfiguration)
- Contents: *.rdl
- Target folder: $(Build.ArtifactStagingDirectory)\Project A
- Copy files
- Source folder: $(build.sourcesdirectory)\Solution Folder\Project B\bin\$(BuildConfiguration)
- Contents: *.rdl
- Target folder: $(Build.ArtifactStagingDirectory)\Project B
- Publish artifact
- Path to publish: $(Build.ArtifactStagingDirectory)
I have created a Reusable Workflow using a workflow_call trigger, but I need to run additional steps based on its outcome.
Example:
jobs:
released:
steps:
- name: Build
uses: my-org/some-repo/.github/workflows/build.yml#main
- name: Upload source maps
run: something
The reusable Build step builds my JS app and produces source maps. Now I need to upload these source maps to somewhere as a separate step that should only run inside this Released job.
Doing the above results in the following error:
Error : .github#L1
reusable workflows should be referenced at the top-level `jobs.*.uses' key, not within steps
It only allows running my reusable workflow inside a job, not inside a step. But by doing that I can no longer access the source maps.
My question: How do I reuse the steps from the Build workflow and access its output inside the Released job?
You can share these output files between jobs using artifacts.
Use the upload-artifact to upload the build files from the Build workflow and download-artifact to download them in the Released workflow.
Build workflow
name: Build
on:
workflow_call:
secrets:
SOME_SECRET:
required: true
jobs:
build:
steps:
# Your build steps here
- name: Create build-output artifact
uses: actions/upload-artifact#master
with:
name: build-output
path: build/
Released workflow
name: Released
on:
push:
branches:
- main
jobs:
build:
uses: my-org/some-repo/.github/workflows/build.yml#main
secrets:
SOME_SECRET: ${{ secrets.SOME_SECRET }}
released:
needs: build
steps:
- name: Download build-output artifact
uses: actions/download-artifact#master
with:
name: build-output
path: build/
# The "build" directory is now available inside this job
- name: Upload source maps
run: something
Bonus tip: Note that the "my-org/some-repo/.github/workflows/build.yml#main" string is case-sensitive. I wasted some time figuring out that that was the cause of the error below.
Error : .github#L1
error parsing called workflow "my-org/some-repo/.github/workflows/build.yml#main": workflow was not found. See https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#access-to-reusable-workflows for more information.
I have created a simple travis configuration which packages an app and tries to deploy the archive file to github.
The problem is, I would like to have the version number part of the file name, so i require to use a pattern for the filename. I simply can't get it to work.
Configuration is currently:
deploy:
provider: releases
file: "build/distributions/worktrail-app-hub-sync*.zip"
on:
repo: worktrail/worktrail-app-hub-sync
tags: true
all_branches: true
But it fails with: "/home/travis/.rvm/gems/ruby-1.9.3-p547/gems/octokit-3.3.1/lib/octokit/client/releases.rb:86:in `initialize': No such file or directory - build/distributions/worktrail-app-hub-sync*.zip (Errno::ENOENT)" - but the file is certainly there: build/distributions/worktrail-app-hub-sync-0.0.1.zip
Example run: https://travis-ci.org/worktrail/worktrail-app-hub-sync/builds/35704111
travis.yml: https://github.com/worktrail/worktrail-app-hub-sync/blob/0.0.1/.travis.yml
Is this supported by travis deployment, or is there any workaround for this use case?
Wildcards are supported by now if you enable the file_glob option. This is how I deploy a build .deb file to GitHub releases:
before_deploy:
- export RELEASE_PKG_FILE=$(ls *.deb)
- echo "deploying $RELEASE_PKG_FILE to GitHub releases"
deploy:
provider: releases
api_key:
secure: YOUR_ENCRYPTED_API_KEY
file_glob: true
file: "${RELEASE_PKG_FILE}"
on:
tags: true
Setting up is easy by executing travis setup releases with a dummy filename and modifying .travis.yml afterwards.
deploy:
file_glob: true
file: "build/distributions/worktrail-app-hub-sync*.zip"
example
Sorry, wildcard patterns don't work at the moment, but we'll have a look into making that possible on Travis CI.