From 1828bacfa89422d6d58ad81d00f24e75c27cd439 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 26 Nov 2020 22:59:49 +0900 Subject: [PATCH] Move from travis to github actions --- .github/.workflows/master.yml | 59 ++++++++++++++++++++++++++ Build/{travis => CI}/applesign.md | 0 Build/{travis => CI}/applesign.sh | 0 Build/{travis => CI}/build.sh | 32 ++++++-------- Build/{travis => CI}/makerelease.sh | 0 Build/{travis => CI}/pgpsign.sh | 0 Build/{travis => CI}/selfsignedcert.sh | 0 Build/{travis => CI}/windowssign.md | 0 8 files changed, 71 insertions(+), 20 deletions(-) create mode 100644 .github/.workflows/master.yml rename Build/{travis => CI}/applesign.md (100%) rename Build/{travis => CI}/applesign.sh (100%) mode change 100755 => 100644 rename Build/{travis => CI}/build.sh (50%) mode change 100755 => 100644 rename Build/{travis => CI}/makerelease.sh (100%) mode change 100755 => 100644 rename Build/{travis => CI}/pgpsign.sh (100%) mode change 100755 => 100644 rename Build/{travis => CI}/selfsignedcert.sh (100%) rename Build/{travis => CI}/windowssign.md (100%) diff --git a/.github/.workflows/master.yml b/.github/.workflows/master.yml new file mode 100644 index 0000000..65756f2 --- /dev/null +++ b/.github/.workflows/master.yml @@ -0,0 +1,59 @@ +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + tags: + - 'Vault/*' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + AZURE_STORAGE_CONTAINER: dist + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + debian-x64: + name: debian-x64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: ./Build/CI/build.sh + env: + RID: debian-x64 + PGP_KEY: ${{ secrets.PGP_KEY }} + AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} + linux-x64: + name: linux-x64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: ./Build/CI/build.sh + env: + RID: linux-x64 + AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} + osx-x64: + name: osx-x64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: ./Build/CI/build.sh + env: + RID: osx-x64 + AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} + win-x64: + name: win-x64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: ./Build/CI/build.sh + env: + RID: win-x64 + WINDOWS_CERT: ${{ secrets.WINDOWS_CERT }} + WINDOWS_CERT_PASSWORD: ${{ secrets.WINDOWS_CERT_PASSWORD }} + AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} + + \ No newline at end of file diff --git a/Build/travis/applesign.md b/Build/CI/applesign.md similarity index 100% rename from Build/travis/applesign.md rename to Build/CI/applesign.md diff --git a/Build/travis/applesign.sh b/Build/CI/applesign.sh old mode 100755 new mode 100644 similarity index 100% rename from Build/travis/applesign.sh rename to Build/CI/applesign.sh diff --git a/Build/travis/build.sh b/Build/CI/build.sh old mode 100755 new mode 100644 similarity index 50% rename from Build/travis/build.sh rename to Build/CI/build.sh index 683b227..530b5f0 --- a/Build/travis/build.sh +++ b/Build/CI/build.sh @@ -3,14 +3,22 @@ set -e DOCKER_IMAGE_NAME="vault-$RID" +DOCKER_BUILD_ARGS="" +if [[ "$PGP_KEY" ]]; then + DOCKER_BUILD_ARGS="--build-arg "PGP_KEY=$PGP_KEY"" +fi +if [[ "$WINDOWS_CERT" ]]; then + DOCKER_BUILD_ARGS="$DOCKER_BUILD_ARGS --build-arg "WINDOWS_CERT=$WINDOWS_CERT" --build-arg "WINDOWS_CERT_PASSWORD=$WINDOWS_CERT_PASSWORD"" +fi + docker build -t "$DOCKER_IMAGE_NAME" $DOCKER_BUILD_ARGS -f "Build/$RID/Dockerfile" . docker run --rm -v "$(pwd)/dist:/opt/dist" "$DOCKER_IMAGE_NAME" -if [[ "$TRAVIS_TAG" ]]; then - travis_version="$(echo "$TRAVIS_TAG" | cut -d'/' -f2)" +if [[ "$GITHUB_REF_NAME" ]]; then + ci_version="$(echo "$GITHUB_REF_NAME" | cut -d'/' -f2)" csproj_version="v$(cat BTCPayServer.Vault/Version.csproj | sed -n 's/.*\(.*\)<\/Version>.*/\1/p')" - if [[ "$travis_version" != "$csproj_version" ]]; then - echo "The tagged version on travis ($travis_version) is different from the csproj ($csproj_version)" + if [[ "$ci_version" != "$csproj_version" ]]; then + echo "The tagged version on travis ($ci_version) is different from the csproj ($csproj_version)" exit 1 fi fi @@ -21,22 +29,6 @@ if ! [[ "$AZURE_STORAGE_CONNECTION_STRING" ]] || ! [[ "$AZURE_STORAGE_CONTAINER" fi curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash az storage container create --name "$AZURE_STORAGE_CONTAINER" --public-access "container" -sudo apt-get install -y ccrypt - -sudo touch dist/secrets -sudo chmod 777 dist/secrets -echo "APPLE_DEV_ID_CERT='$APPLE_DEV_ID_CERT'" >> dist/secrets -echo "APPLE_DEV_ID_CERT_PASSWORD='$APPLE_DEV_ID_CERT_PASSWORD'" >> dist/secrets -echo "APPLE_ID='$APPLE_ID'" >> dist/secrets -echo "APPLE_ID_PASSWORD='$APPLE_ID_PASSWORD'" >> dist/secrets -echo "AZURE_STORAGE_CONNECTION_STRING='$AZURE_STORAGE_CONNECTION_STRING'" >> dist/secrets -echo "AZURE_STORAGE_CONTAINER='$AZURE_STORAGE_CONTAINER'" >> dist/secrets -echo "GITHUB_TOKEN='$GITHUB_TOKEN'" >> dist/secrets -echo "PGP_KEY='$PGP_KEY'" >> dist/secrets -echo "WINDOWS_CERT='$WINDOWS_CERT'" >> dist/secrets -echo "WINDOWS_CERT_PASSWORD='$WINDOWS_CERT_PASSWORD'" >> dist/secrets - -sudo ccencrypt dist/secrets -K $ENC_KEY for file in dist/*; do BLOB_NAME="dist-$TRAVIS_BUILD_ID/$(basename -- $file)" diff --git a/Build/travis/makerelease.sh b/Build/CI/makerelease.sh old mode 100755 new mode 100644 similarity index 100% rename from Build/travis/makerelease.sh rename to Build/CI/makerelease.sh diff --git a/Build/travis/pgpsign.sh b/Build/CI/pgpsign.sh old mode 100755 new mode 100644 similarity index 100% rename from Build/travis/pgpsign.sh rename to Build/CI/pgpsign.sh diff --git a/Build/travis/selfsignedcert.sh b/Build/CI/selfsignedcert.sh similarity index 100% rename from Build/travis/selfsignedcert.sh rename to Build/CI/selfsignedcert.sh diff --git a/Build/travis/windowssign.md b/Build/CI/windowssign.md similarity index 100% rename from Build/travis/windowssign.md rename to Build/CI/windowssign.md