How to publish Travis CI artifacts to GitHub Release from several jobs

saber-nyan

I have three Travis CI jobs to build my application for different operating systems.
Each operating system has a separate job: OS X for osx-x64, Linux for linux-x64 and Windows for win-x64.

After the build, I get one file of my application, it is located on the path ImagePoster4DTF/ImagePoster4DTF/bin/Release/netcoreapp3.1/{win-x64,linux-x64,osx-x64}/publish/ImagePoster4DTF{.exe,}.

How can I upload three files from different jobs to a single GitHub release?

My current .travis.yml file that does not work:

language: csharp
mono: none
dotnet: 3.1.301

git:
  depth: 2
  quiet: true
  symlinks: true

script:
  - dotnet restore

jobs:
  include:
    - os: linux
      script: dotnet publish -r linux-x64 --configuration Release -p:PublishSingleFile=true
    - os: osx
      script: dotnet publish -r osx-x64 --configuration Release -p:PublishSingleFile=true
    - os: windows
      script: dotnet publish -r win-x64 --configuration Release -p:PublishSingleFile=true
    - stage: Publish GitHub release
      before_deploy:
        # Set up git user name and tag this commit
        - git config --local user.name "Artoria Pendragon"
        - git config --local user.email "[email protected]"
        - export TRAVIS_TAG=${TRAVIS_TAG:-$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)}
        - git tag $TRAVIS_TAG
      deploy:
        provider: releases
        api_key:
          secure: SOME_ENCRYPTED_KEY
        file_glob: true
        file: "ImagePoster4DTF/bin/Release/netcoreapp3.1/**/publish/*"
        skip_cleanup: true

saber-nyan

Seems like it worked with this config:

language: csharp
mono: none

branches:
  except:
    - /^untagged/
    - /^nightly/

git:
  depth: 2
  quiet: true
  symlinks: true

jobs:
  include:
    - stage: "Compile for amd64 Windows"
      os: windows
      script:
        - choco install dotnetcore-sdk
        - dotnet --version
        - dotnet restore
        - dotnet publish -r win-x64 --configuration Release -p:PublishSingleFile=true
      deploy: &deploy_base
        provider: releases
        api_key:
          secure: SOME_ENCRYPTED_KEY
        file: "ImagePoster4DTF/bin/Release/netcoreapp3.1/win-x64/publish/ImagePoster4DTF.exe"
        draft: true
        tag_name: $TRAVIS_TAG
        target_commitish: $TRAVIS_COMMIT
        name: $TRAVIS_TAG
        overwrite: true
        skip_cleanup: true
    - stage: "Compile for amd64 macOS"
      os: osx
      osx_image: xcode11.5
      dotnet: 3.1.301
      script:
        - dotnet restore
        - dotnet publish -r osx-x64 --configuration Release -p:PublishSingleFile=true
        - "cp ./ImagePoster4DTF/bin/Release/netcoreapp3.1/osx-x64/publish/ImagePoster4DTF ./ImagePoster4DTF_macOS"
      deploy:
        <<: *deploy_base
        file: "ImagePoster4DTF_macOS"
    - stage: "Compile for amd64 GNU/Linux and deploy GitHub Release"
      os: linux
      dist: bionic
      dotnet: 3.1.301
      script:
        - dotnet restore
        - dotnet publish -r linux-x64 --configuration Release -p:PublishSingleFile=true
        - "cp ./ImagePoster4DTF/bin/Release/netcoreapp3.1/linux-x64/publish/ImagePoster4DTF ./ImagePoster4DTF_linux"
      deploy:
        <<: *deploy_base
        draft: false
        file: "ImagePoster4DTF_linux"

before_deploy:
  - git config --local user.name "Artoria Pendragon"
  - git config --local user.email "[email protected]"
  - export TRAVIS_TAG="nightly-$TRAVIS_BUILD_NUMBER"
  - echo "Tagging commit ${TRAVIS_COMMIT} with tag ${TRAVIS_TAG}"
  - git tag "$TRAVIS_TAG" "$TRAVIS_COMMIT"

Success

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to use artifactoryPublish to publish release and debug artifacts

How to publish artifacts separately for each project in solution from VSTS CI pipeline?

gitlab ci: Pass artifacts from two jobs of the same stage

How to publish custom artifacts to Artifactory from TeamCity?

Travis-CI Auto-Tag Build for GitHub Release

Release definition to publish nuget packages for multiple artifacts

How can I copy artifacts from executed jobs with declarative pipeline?

Gradle Artifactory Plugin - How to publish artifacts from multiple modules in a project?

Signing generated artifacts on Travis-CI

Github actions share workspace/artifacts between jobs?

exclude files from triggering a travis ci build on github

Remove artifacts from CI manually

How to make sure Travis-CI is correctly synced with GitHub repo?

How to get Travis CI to build and test xcode projects hosted on Github?

How to deploy to github releases from travis

Pipeline GitHub -> Travis CI -> Docker

Pipelines: cannot publish a file from artifacts directory

How to manually publish a file to Azure Artifacts?

How to release chrome extension from GitHub repository

How to publish docker images to docker hub from gitlab-ci

how to publish to github pages?

Installing specific R package from specific branch from github repo on travis-ci

How can I deploy a release with multiple artifacts

Semantic-release does not publish after successful travis run

How can I deploy artifacts from a Maven build to the SourceForge File Release System?

How to trigger nightly deployment only when artifacts had changed from last release

How to avoid "The job exceeded the maximum time limit for jobs, and has been terminated." when accessing mvnsearch.org on Travis CI?

Error authenticating Github using Travis CI

Getting the Travis CI build status of a GitHub commit

TOP Ranking

HotTag

Archive