CI: Fix snapcraft job

This commit is contained in:
Christian Pauly 2021-03-06 09:33:06 +01:00
parent eb0eca4c0a
commit 8865222032
4 changed files with 51 additions and 54 deletions

View File

@ -25,7 +25,8 @@ test:
build_web: build_web:
stage: coverage stage: coverage
before_script: [sudo apt update && sudo apt install curl -y, ./scripts/prepare-web.sh] before_script:
[sudo apt update && sudo apt install curl -y, ./scripts/prepare-web.sh]
script: [./scripts/build-web.sh] script: [./scripts/build-web.sh]
artifacts: artifacts:
paths: paths:
@ -44,8 +45,8 @@ build_windows:
- cd ..; git clone https://github.com/flutter/flutter.git -b dev; $env:path += ";C:\GitLab-Runner\builds\famedly\flutter\bin"; cd fluffychat - cd ..; git clone https://github.com/flutter/flutter.git -b dev; $env:path += ";C:\GitLab-Runner\builds\famedly\flutter\bin"; cd fluffychat
- flutter doctor - flutter doctor
- flutter config --enable-windows-desktop - flutter config --enable-windows-desktop
- "$package_override = \"`r`ndependency_overrides:`r`n intl: 0.17.0-nullsafety.2\"" - '$package_override = "`r`ndependency_overrides:`r`n intl: 0.17.0-nullsafety.2"'
- "[System.IO.File]::AppendAllText(\"$CI_PROJECT_DIR/pubspec.yaml\", $package_override, [System.Text.Encoding]::UTF8)" - '[System.IO.File]::AppendAllText("$CI_PROJECT_DIR/pubspec.yaml", $package_override, [System.Text.Encoding]::UTF8)'
- flutter clean - flutter clean
- flutter pub get - flutter pub get
- flutter build windows - flutter build windows
@ -94,9 +95,9 @@ build_android_appbundle:
upload-fdroid: upload-fdroid:
stage: release stage: release
before_script: before_script:
- 'which ssh-agent || (sudo apt-get update -y && sudo apt-get install openssh-client -y )' - "which ssh-agent || (sudo apt-get update -y && sudo apt-get install openssh-client -y )"
- 'which rsync || (sudo apt-get update -y && sudo apt-get install rsync -y )' - "which rsync || (sudo apt-get update -y && sudo apt-get install rsync -y )"
- 'which pcregrep || (sudo apt-get update -y && sudo apt-get install pcregrep -y )' - "which pcregrep || (sudo apt-get update -y && sudo apt-get install pcregrep -y )"
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
@ -116,9 +117,9 @@ upload-fdroid:
upload-fdroid-nightly: upload-fdroid-nightly:
stage: release stage: release
before_script: before_script:
- 'which ssh-agent || (sudo apt-get update -y && sudo apt-get install openssh-client -y )' - "which ssh-agent || (sudo apt-get update -y && sudo apt-get install openssh-client -y )"
- 'which rsync || (sudo apt-get update -y && sudo apt-get install rsync -y )' - "which rsync || (sudo apt-get update -y && sudo apt-get install rsync -y )"
- 'which pcregrep || (sudo apt-get update -y && sudo apt-get install pcregrep -y )' - "which pcregrep || (sudo apt-get update -y && sudo apt-get install pcregrep -y )"
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
@ -156,7 +157,10 @@ pages:
build_linux: build_linux:
stage: coverage stage: coverage
before_script: [sudo apt update && sudo apt install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev -y] before_script:
[
sudo apt update && sudo apt install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev -y,
]
script: [./scripts/build-linux.sh] script: [./scripts/build-linux.sh]
artifacts: artifacts:
when: on_success when: on_success
@ -164,35 +168,36 @@ build_linux:
- build/linux/release/bundle/ - build/linux/release/bundle/
allow_failure: true allow_failure: true
#snap:edge: snap:edge:
# stage: release stage: release
# image: "cibuilds/snapcraft:core18" image: "cibuilds/snapcraft:core18"
# variables: variables:
# SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE} SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE}
# only: only:
# - main - main
# script: [./scripts/publish-snap-edge.sh] script: [./scripts/publish-snap-edge.sh]
# artifacts: needs: ["build_linux"]
# paths: artifacts:
# - './*.snap' paths:
# when: on_success - "./*.snap"
# allow_failure: true when: on_success
allow_failure: true
#snap:publish: snap:publish:
# stage: release stage: release
# image: "cibuilds/snapcraft:core18" image: "cibuilds/snapcraft:core18"
# variables: variables:
# SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE} SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE}
# only: only:
# - tags - tags
# script: [./scripts/publish-snap-stable.sh] script: [./scripts/publish-snap-stable.sh]
# artifacts: needs: ["build_linux"]
# paths: artifacts:
# - './*.snap' paths:
# when: on_success - "./*.snap"
# expire_in: 1 week when: on_success
# needs: [] expire_in: 1 week
# allow_failure: true allow_failure: true
update-dependencies: update-dependencies:
stage: coverage stage: coverage

View File

@ -1,8 +0,0 @@
#!/bin/sh -ve
'curl -L $(curl -H "X-Ubuntu-Series: 16" "https://api.snapcraft.io/api/v1/snaps/details/flutter?channel=latest/stable" | jq ".download_url" -r) --output flutter.snap'
sudo mkdir -p /snap/flutter
sudo unsquashfs -d /snap/flutter/current flutter.snap
rm -f flutter.snap
sudo ln -sf /snap/flutter/current/flutter.sh /snap/bin/flutter
sudo ln -sf /snap/flutter/current/env.sh /snap/bin/env.sh
snapcraft

View File

@ -1,5 +1,5 @@
#!/bin/sh -ve #!/bin/sh -ve
/bin/bash ./scripts/build-snap.sh snapcraft
echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > snapcraft.login echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > snapcraft.login
snapcraft login --with snapcraft.login snapcraft login --with snapcraft.login
snapcraft push --release=edge *.snap snapcraft push --release=edge *.snap

View File

@ -1,5 +1,5 @@
#!/bin/sh -ve #!/bin/sh -ve
/bin/bash ./scripts/build-snap.sh snapcraft
echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > snapcraft.login echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > snapcraft.login
snapcraft login --with snapcraft.login snapcraft login --with snapcraft.login
snapcraft push --release=stable *.snap snapcraft push --release=stable *.snap