2019-03-03 15:55:55 +00:00
|
|
|
# GitLab CI configuration for ffsend builds, tests and releases
|
|
|
|
#
|
|
|
|
# To add a new release:
|
|
|
|
# - configure a new 'build-*' job with the proper target
|
|
|
|
# - export a build artifact from the new job
|
|
|
|
# - manually upload artifact to GitHub in the 'github-release' job
|
|
|
|
|
2018-06-04 23:06:12 +00:00
|
|
|
image: "rust:slim"
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- check
|
2018-06-23 15:02:02 +00:00
|
|
|
- build
|
2018-06-04 23:06:12 +00:00
|
|
|
- test
|
|
|
|
- release
|
2019-03-03 19:32:10 +00:00
|
|
|
- package
|
2018-06-04 23:06:12 +00:00
|
|
|
|
2020-02-11 17:24:54 +00:00
|
|
|
# Variable defaults
|
2018-06-04 23:06:12 +00:00
|
|
|
variables:
|
|
|
|
RUST_VERSION: stable
|
2020-02-11 17:24:54 +00:00
|
|
|
RUST_TARGET: x86_64-unknown-linux-gnu
|
2018-06-04 23:06:12 +00:00
|
|
|
|
2018-11-20 15:23:32 +00:00
|
|
|
# Cache rust/cargo/build artifacts
|
|
|
|
cache:
|
|
|
|
key: "$CI_PIPELINE_ID-$RUST_VERSION"
|
|
|
|
paths:
|
|
|
|
- /usr/local/cargo/registry/
|
|
|
|
- /usr/local/rustup/toolchains/
|
|
|
|
- /usr/local/rustup/update-hashes/
|
|
|
|
- target/
|
|
|
|
|
2020-05-17 11:49:06 +00:00
|
|
|
# Install compiler and OpenSSL dependencies
|
2018-06-04 23:06:12 +00:00
|
|
|
before_script:
|
2018-06-23 15:02:02 +00:00
|
|
|
- apt-get update
|
2020-05-17 11:49:06 +00:00
|
|
|
- apt-get install -y --no-install-recommends build-essential pkg-config libssl-dev
|
2018-06-23 15:02:02 +00:00
|
|
|
- |
|
|
|
|
rustup install $RUST_VERSION
|
|
|
|
rustup default $RUST_VERSION
|
|
|
|
- |
|
|
|
|
rustc --version
|
|
|
|
cargo --version
|
2018-06-04 23:06:12 +00:00
|
|
|
|
2021-08-25 22:41:18 +00:00
|
|
|
# Check on stable, beta and nightly
|
2019-03-03 23:21:15 +00:00
|
|
|
.check-base: &check-base
|
|
|
|
stage: check
|
|
|
|
script:
|
2019-05-10 14:02:58 +00:00
|
|
|
- cargo check --verbose
|
2020-05-17 11:45:09 +00:00
|
|
|
- cargo check --no-default-features --features send3,crypto-ring --verbose
|
|
|
|
- cargo check --no-default-features --features send2,crypto-openssl --verbose
|
|
|
|
- cargo check --no-default-features --features send3,crypto-openssl --verbose
|
|
|
|
- cargo check --no-default-features --features send2,send3,crypto-openssl --verbose
|
|
|
|
- cargo check --no-default-features --features send3,crypto-ring,archive --verbose
|
|
|
|
- cargo check --no-default-features --features send3,crypto-ring,history --verbose
|
|
|
|
- cargo check --no-default-features --features send3,crypto-ring,qrcode --verbose
|
|
|
|
- cargo check --no-default-features --features send3,crypto-ring,urlshorten --verbose
|
|
|
|
- cargo check --no-default-features --features send3,crypto-ring,infer-command --verbose
|
2019-03-03 23:21:15 +00:00
|
|
|
- cargo check --features no-color --verbose
|
2019-03-06 19:58:47 +00:00
|
|
|
check-stable:
|
2019-03-03 23:21:15 +00:00
|
|
|
<<: *check-base
|
2019-03-06 19:58:47 +00:00
|
|
|
check-beta:
|
2019-03-03 23:21:15 +00:00
|
|
|
<<: *check-base
|
|
|
|
variables:
|
|
|
|
RUST_VERSION: beta
|
2019-03-06 19:58:47 +00:00
|
|
|
check-nightly:
|
2019-03-03 23:21:15 +00:00
|
|
|
<<: *check-base
|
|
|
|
variables:
|
|
|
|
RUST_VERSION: nightly
|
2023-02-20 10:16:30 +00:00
|
|
|
check-msrv:
|
2019-03-03 23:21:15 +00:00
|
|
|
<<: *check-base
|
|
|
|
variables:
|
2023-08-20 15:48:39 +00:00
|
|
|
RUST_VERSION: "1.63.0"
|
2018-06-23 15:02:02 +00:00
|
|
|
|
|
|
|
# Build using Rust stable
|
2019-03-03 14:46:11 +00:00
|
|
|
build-x86_64-linux-gnu:
|
2018-06-23 15:02:02 +00:00
|
|
|
stage: build
|
2020-10-26 11:28:48 +00:00
|
|
|
needs: []
|
2018-06-23 15:02:02 +00:00
|
|
|
script:
|
2019-03-03 14:46:11 +00:00
|
|
|
- cargo build --target=$RUST_TARGET --release --verbose
|
2019-03-03 15:24:00 +00:00
|
|
|
- mv target/$RUST_TARGET/release/ffsend ./ffsend-$RUST_TARGET
|
2019-03-03 15:55:55 +00:00
|
|
|
- strip -g ./ffsend-$RUST_TARGET
|
2018-06-23 15:02:02 +00:00
|
|
|
artifacts:
|
2019-03-03 14:46:11 +00:00
|
|
|
name: ffsend-x86_64-linux-gnu
|
2018-06-23 15:02:02 +00:00
|
|
|
paths:
|
2019-03-03 15:24:00 +00:00
|
|
|
- ffsend-$RUST_TARGET
|
2018-06-23 15:02:02 +00:00
|
|
|
expire_in: 1 month
|
|
|
|
|
|
|
|
# Build a static version
|
2019-03-03 14:46:11 +00:00
|
|
|
build-x86_64-linux-musl:
|
2018-06-23 15:02:02 +00:00
|
|
|
stage: build
|
2020-10-26 11:28:48 +00:00
|
|
|
needs: []
|
2019-03-03 14:46:11 +00:00
|
|
|
variables:
|
|
|
|
RUST_TARGET: x86_64-unknown-linux-musl
|
2018-06-23 15:02:02 +00:00
|
|
|
script:
|
|
|
|
# Install the static target
|
2019-03-03 14:46:11 +00:00
|
|
|
- rustup target add $RUST_TARGET
|
2018-06-23 15:02:02 +00:00
|
|
|
|
|
|
|
# Build OpenSSL statically
|
2020-02-11 17:24:54 +00:00
|
|
|
- apt-get install -y build-essential wget musl-tools
|
2023-05-18 21:12:06 +00:00
|
|
|
- wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1k.tar.gz
|
|
|
|
- tar xzvf openssl-1.1.1k.tar.gz
|
|
|
|
- cd openssl-1.1.1k
|
2021-10-07 11:07:07 +00:00
|
|
|
- ./config no-async -fPIC --openssldir=/usr/local/ssl --prefix=/usr/local
|
2018-06-23 15:02:02 +00:00
|
|
|
- make
|
|
|
|
- make install
|
|
|
|
- cd ..
|
|
|
|
|
|
|
|
# Statically build ffsend
|
|
|
|
- export OPENSSL_STATIC=1
|
|
|
|
- export OPENSSL_LIB_DIR=/usr/local/lib
|
|
|
|
- export OPENSSL_INCLUDE_DIR=/usr/local/include
|
2019-03-03 14:46:11 +00:00
|
|
|
- cargo build --target=$RUST_TARGET --release --verbose
|
2018-06-23 15:02:02 +00:00
|
|
|
|
2019-03-03 15:55:55 +00:00
|
|
|
# Prepare the release artifact, strip it
|
2018-06-23 15:02:02 +00:00
|
|
|
- find . -name ffsend -exec ls -lah {} \;
|
2019-03-03 15:24:00 +00:00
|
|
|
- mv target/$RUST_TARGET/release/ffsend ./ffsend-$RUST_TARGET
|
2019-03-03 15:55:55 +00:00
|
|
|
- strip -g ./ffsend-$RUST_TARGET
|
2018-06-23 15:02:02 +00:00
|
|
|
artifacts:
|
2019-03-03 14:46:11 +00:00
|
|
|
name: ffsend-x86_64-linux-musl
|
2018-06-23 15:02:02 +00:00
|
|
|
paths:
|
2019-03-03 15:24:00 +00:00
|
|
|
- ffsend-$RUST_TARGET
|
2018-06-23 15:02:02 +00:00
|
|
|
expire_in: 1 month
|
2018-06-04 23:06:12 +00:00
|
|
|
|
2019-03-03 23:21:15 +00:00
|
|
|
# Run the unit tests through Cargo
|
2019-03-06 19:58:47 +00:00
|
|
|
test-cargo:
|
2019-03-03 23:21:15 +00:00
|
|
|
stage: test
|
2020-10-26 11:28:48 +00:00
|
|
|
needs: []
|
2019-03-03 23:21:15 +00:00
|
|
|
dependencies: []
|
|
|
|
script:
|
|
|
|
- cargo test --verbose
|
|
|
|
|
|
|
|
# Run integration test with the public Send service
|
2019-03-06 19:58:47 +00:00
|
|
|
test-public:
|
2019-03-12 13:14:54 +00:00
|
|
|
image: alpine:latest
|
2019-03-03 23:21:15 +00:00
|
|
|
stage: test
|
|
|
|
dependencies:
|
|
|
|
- build-x86_64-linux-musl
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
RUST_TARGET: x86_64-unknown-linux-musl
|
2021-10-07 11:09:24 +00:00
|
|
|
before_script: []
|
2019-03-03 23:21:15 +00:00
|
|
|
script:
|
2019-03-12 13:14:54 +00:00
|
|
|
# Prepare ffsend binary, create random file
|
|
|
|
- mv ./ffsend-$RUST_TARGET ./ffsend
|
|
|
|
- chmod a+x ./ffsend
|
|
|
|
- head -c1m </dev/urandom >test.txt
|
|
|
|
|
2019-03-03 23:21:15 +00:00
|
|
|
# Generate random file, upload/download and assert equality
|
2019-03-12 15:46:03 +00:00
|
|
|
- ./ffsend upload test.txt -I
|
2019-03-12 13:14:54 +00:00
|
|
|
- ./ffsend download $(./ffsend history -q) -I -o=download.txt
|
2019-03-12 18:09:20 +00:00
|
|
|
- "cmp -s ./test.txt ./download.txt || (echo ERROR: Downloaded file is different than original; exit 1)"
|
2019-03-12 13:14:54 +00:00
|
|
|
- rm ./download.txt
|
2019-02-28 08:56:50 +00:00
|
|
|
|
2018-10-17 15:48:37 +00:00
|
|
|
# Cargo crate release
|
2019-03-06 19:58:47 +00:00
|
|
|
release-crate:
|
2018-10-17 15:48:37 +00:00
|
|
|
stage: release
|
2019-03-06 19:58:47 +00:00
|
|
|
dependencies: []
|
2018-10-17 15:48:37 +00:00
|
|
|
only:
|
|
|
|
- /^v(\d+\.)*\d+$/
|
|
|
|
script:
|
|
|
|
- echo "Creating release crate to publish on crates.io..."
|
|
|
|
- echo $CARGO_TOKEN | cargo login
|
|
|
|
- echo "Publishing crate to crates.io..."
|
2018-10-17 18:26:25 +00:00
|
|
|
- cargo publish --verbose --allow-dirty
|
2019-01-03 13:08:50 +00:00
|
|
|
|
2019-03-06 15:43:21 +00:00
|
|
|
# Snap release
|
2019-03-06 19:58:47 +00:00
|
|
|
release-snap:
|
2019-09-29 22:07:56 +00:00
|
|
|
image: snapcore/snapcraft:stable
|
2019-03-06 15:43:21 +00:00
|
|
|
stage: release
|
2019-03-06 19:58:47 +00:00
|
|
|
dependencies: []
|
2019-03-06 15:43:21 +00:00
|
|
|
only:
|
|
|
|
- /^v(\d+\.)*\d+$/
|
|
|
|
before_script: []
|
|
|
|
script:
|
|
|
|
# Prepare the environment
|
|
|
|
- apt-get update -y
|
2019-09-29 22:07:56 +00:00
|
|
|
- apt-get install python3 -yqq
|
2019-03-06 15:43:21 +00:00
|
|
|
- cd pkg/snap
|
|
|
|
|
2019-03-06 17:43:02 +00:00
|
|
|
# Update version number in snapcraft.yaml
|
2019-03-06 15:43:21 +00:00
|
|
|
- VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-)
|
2019-03-06 17:43:02 +00:00
|
|
|
- echo "Determined binary version number 'v$VERSION', updating snapcraft.yaml..."
|
|
|
|
- 'sed "s/^version:.*\$/version: $VERSION/" -i snapcraft.yaml'
|
|
|
|
- 'sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i snapcraft.yaml'
|
2019-03-06 15:43:21 +00:00
|
|
|
|
|
|
|
# Build the package
|
|
|
|
- echo "Building snap package..."
|
|
|
|
- snapcraft
|
|
|
|
|
|
|
|
# Publish snap package
|
|
|
|
- echo "Publishing snap package..."
|
2019-03-06 19:58:47 +00:00
|
|
|
- echo "$SNAPCRAFT_LOGIN" | base64 -d > snapcraft.login
|
2022-06-20 08:04:37 +00:00
|
|
|
- snapcraft whoami
|
2019-03-06 15:43:21 +00:00
|
|
|
- snapcraft push --release=stable ffsend_*_amd64.snap
|
2019-03-06 19:58:47 +00:00
|
|
|
artifacts:
|
|
|
|
name: ffsend-snap-x86_64
|
|
|
|
paths:
|
|
|
|
- pkg/snap/ffsend_*_amd64.snap
|
|
|
|
expire_in: 1 month
|
2019-03-06 15:43:21 +00:00
|
|
|
|
2019-03-03 15:24:00 +00:00
|
|
|
# Publish release binaries to as GitHub release
|
2019-03-06 19:58:47 +00:00
|
|
|
release-github:
|
2019-03-03 15:24:00 +00:00
|
|
|
stage: release
|
2019-03-03 23:21:15 +00:00
|
|
|
only:
|
|
|
|
- /^v(\d+\.)*\d+$/
|
2019-03-03 15:24:00 +00:00
|
|
|
dependencies:
|
|
|
|
- build-x86_64-linux-gnu
|
|
|
|
- build-x86_64-linux-musl
|
|
|
|
before_script: []
|
|
|
|
script:
|
2019-03-03 17:49:37 +00:00
|
|
|
# Install dependencies
|
|
|
|
- apt-get update
|
2019-03-03 23:53:03 +00:00
|
|
|
- apt-get install -y curl wget gzip netbase
|
2019-03-03 17:49:37 +00:00
|
|
|
|
2019-03-03 15:24:00 +00:00
|
|
|
# Download github-release binary
|
2020-05-11 20:16:56 +00:00
|
|
|
- wget https://github.com/tfausak/github-release/releases/download/1.2.5/github-release-linux.gz -O github-release.gz
|
2019-03-03 19:32:10 +00:00
|
|
|
- gunzip github-release.gz
|
2019-03-03 22:32:18 +00:00
|
|
|
- chmod a+x ./github-release
|
2019-03-03 15:24:00 +00:00
|
|
|
|
2019-03-03 23:20:12 +00:00
|
|
|
# Create the release, upload binaries
|
|
|
|
- ./github-release release --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$CI_COMMIT_REF_NAME" --title "ffsend $CI_COMMIT_REF_NAME"
|
|
|
|
- ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$CI_COMMIT_REF_NAME" --file ./ffsend-x86_64-unknown-linux-gnu --name ffsend-$CI_COMMIT_REF_NAME-linux-x64
|
|
|
|
- ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$CI_COMMIT_REF_NAME" --file ./ffsend-x86_64-unknown-linux-musl --name ffsend-$CI_COMMIT_REF_NAME-linux-x64-static
|
2019-03-03 15:24:00 +00:00
|
|
|
|
2019-03-13 17:41:36 +00:00
|
|
|
# Publish a Docker image
|
|
|
|
release-docker:
|
|
|
|
image: docker:git
|
|
|
|
stage: release
|
|
|
|
only:
|
|
|
|
- /^v(\d+\.)*\d+$/
|
|
|
|
dependencies:
|
|
|
|
- build-x86_64-linux-musl
|
2019-03-13 19:51:54 +00:00
|
|
|
services:
|
|
|
|
- docker:dind
|
2019-03-13 17:41:36 +00:00
|
|
|
variables:
|
|
|
|
RUST_TARGET: x86_64-unknown-linux-musl
|
2019-03-13 19:51:54 +00:00
|
|
|
DOCKER_HOST: tcp://docker:2375
|
|
|
|
# DOCKER_DRIVER: overlay2
|
2019-03-13 17:41:36 +00:00
|
|
|
before_script: []
|
|
|
|
script:
|
|
|
|
# Place binary in Docker directory, change to it
|
|
|
|
- mv ./ffsend-$RUST_TARGET ./pkg/docker/ffsend
|
|
|
|
- cd ./pkg/docker
|
|
|
|
|
|
|
|
# Build the Docker image, run it once to test
|
|
|
|
- docker build -t timvisee/ffsend:latest ./
|
2019-06-20 22:18:03 +00:00
|
|
|
- docker run --rm timvisee/ffsend:latest -V
|
2019-03-13 17:41:36 +00:00
|
|
|
|
|
|
|
# Retag version
|
|
|
|
- VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-)
|
|
|
|
- echo "Determined Docker image version number 'v$VERSION', retagging image..."
|
|
|
|
- docker tag timvisee/ffsend:latest timvisee/ffsend:$VERSION
|
|
|
|
|
|
|
|
# Authenticate and push the Docker images
|
|
|
|
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin
|
|
|
|
- docker push timvisee/ffsend:$VERSION
|
|
|
|
- docker push timvisee/ffsend:latest
|
|
|
|
|
2019-03-03 17:31:21 +00:00
|
|
|
# AUR packages release
|
2019-03-03 19:32:10 +00:00
|
|
|
package-aur:
|
2021-05-02 15:54:08 +00:00
|
|
|
image: archlinux
|
2019-03-03 19:32:10 +00:00
|
|
|
stage: package
|
2019-08-23 15:33:14 +00:00
|
|
|
needs:
|
|
|
|
- release-github
|
2019-03-06 19:58:47 +00:00
|
|
|
dependencies: []
|
2019-01-12 22:19:11 +00:00
|
|
|
only:
|
|
|
|
- /^v(\d+\.)*\d+$/
|
|
|
|
before_script: []
|
|
|
|
script:
|
|
|
|
- cd ./pkg/aur
|
|
|
|
|
2019-03-26 11:36:16 +00:00
|
|
|
# Determine the version number we're releasing for
|
2019-01-12 22:19:11 +00:00
|
|
|
- VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-)
|
2019-03-26 11:36:16 +00:00
|
|
|
- echo "Determined binary version number 'v$VERSION'"
|
|
|
|
|
|
|
|
# Determine remote URLs and SHA checksums
|
|
|
|
- echo "Determining SHA checksums for remote files..."
|
|
|
|
- URL_BIN=https://github.com/timvisee/ffsend/releases/download/v$VERSION/ffsend-v$VERSION-linux-x64-static
|
|
|
|
- URL_SOURCE=https://gitlab.com/timvisee/ffsend/-/archive/v$VERSION/ffsend-v$VERSION.tar.gz
|
2019-04-02 14:21:26 +00:00
|
|
|
- URL_BASH_COMPLETION=https://gitlab.com/timvisee/ffsend/raw/v$VERSION/contrib/completions/ffsend.bash
|
2019-08-28 17:59:04 +00:00
|
|
|
- URL_ZSH_COMPLETION=https://gitlab.com/timvisee/ffsend/raw/v$VERSION/contrib/completions/_ffsend
|
2019-04-02 14:21:26 +00:00
|
|
|
- URL_FISH_COMPLETION=https://gitlab.com/timvisee/ffsend/raw/v$VERSION/contrib/completions/ffsend.fish
|
2019-08-28 17:59:04 +00:00
|
|
|
- URL_LICENSE=https://gitlab.com/timvisee/ffsend/raw/v$VERSION/LICENSE
|
2019-03-26 11:36:16 +00:00
|
|
|
- 'echo "Selected binary URL: $URL_BIN"'
|
|
|
|
- 'echo "Selected source URL: $URL_SOURCE"'
|
|
|
|
- echo "Determining sha256sum for remote binary..."
|
|
|
|
- 'SHA_BIN=$(curl -sSL "$URL_BIN" | sha256sum | cut -d" " -f1)'
|
|
|
|
- 'echo "Got sha256sum: $SHA_BIN"'
|
2019-04-02 14:21:26 +00:00
|
|
|
- 'SHA_BASH_COMPLETION=$(curl -sSL "$URL_BASH_COMPLETION" | sha256sum | cut -d" " -f1)'
|
2019-04-02 13:40:10 +00:00
|
|
|
- 'echo "Got sha256sums of bash completion: $SHA_BASH_COMPLETION"'
|
2019-08-28 17:59:04 +00:00
|
|
|
- 'SHA_ZSH_COMPLETION=$(curl -sSL "$URL_ZSH_COMPLETION" | sha256sum | cut -d" " -f1)'
|
|
|
|
- 'echo "Got sha256sums of ZSH completion: $SHA_ZSH_COMPLETION"'
|
2019-04-02 14:21:26 +00:00
|
|
|
- 'SHA_FISH_COMPLETION=$(curl -sSL "$URL_FISH_COMPLETION" | sha256sum | cut -d" " -f1)'
|
2019-04-02 13:40:10 +00:00
|
|
|
- 'echo "Got sha256sums of fish completion: $SHA_FISH_COMPLETION"'
|
2019-08-28 17:59:04 +00:00
|
|
|
- 'SHA_LICENSE=$(curl -sSL "$URL_LICENSE" | sha256sum | cut -d" " -f1)'
|
|
|
|
- 'echo "Got sha256sums of LICENSE: $SHA_LICENSE"'
|
2019-03-26 11:36:16 +00:00
|
|
|
- echo "Determining sha256sum for remote source..."
|
|
|
|
- 'SHA_SOURCE=$(curl -sSL "$URL_SOURCE" | sha256sum | cut -d" " -f1)'
|
|
|
|
- 'echo "Got sha256sum: $SHA_SOURCE"'
|
|
|
|
|
|
|
|
# Update PKGBUILD parameters: version, source URL and SHA sum
|
|
|
|
- echo "Updating PKGBUILDS with release information..."
|
|
|
|
- sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i ffsend/PKGBUILD
|
|
|
|
- sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i ffsend-bin/PKGBUILD
|
2019-03-26 12:49:16 +00:00
|
|
|
- sed "s/^pkgver=.*\$/pkgver=$VERSION.$CI_COMMIT_SHORT_SHA/" -i ffsend-git/PKGBUILD
|
2021-08-31 14:03:38 +00:00
|
|
|
- sed "s/^source=(\".*\").*\$/source=(\"$(echo $URL_SOURCE | sed 's/\//\\\//g')\")/" -i ffsend/PKGBUILD
|
2019-04-04 10:12:04 +00:00
|
|
|
- sed "s/\(\"ffsend-v\$pkgver::\).*\"/\1$(echo $URL_BIN | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD
|
2019-04-04 08:48:48 +00:00
|
|
|
- sed "s/\(\"ffsend-v\$pkgver.bash::\).*\"/\1$(echo $URL_BASH_COMPLETION | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD
|
2019-08-28 17:59:04 +00:00
|
|
|
- sed "s/\(\"ffsend-v\$pkgver.zsh::\).*\"/\1$(echo $URL_ZSH_COMPLETION | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD
|
2019-04-04 08:48:48 +00:00
|
|
|
- sed "s/\(\"ffsend-v\$pkgver.fish::\).*\"/\1$(echo $URL_FISH_COMPLETION | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD
|
2019-08-28 17:59:04 +00:00
|
|
|
- sed "s/\(\"LICENSE-v\$pkgver::\).*\"/\1$(echo $URL_LICENSE | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD
|
2019-03-26 11:36:16 +00:00
|
|
|
- sed "s/^sha256sums=.*\$/sha256sums=('$SHA_SOURCE')/" -i ffsend/PKGBUILD
|
2019-08-28 17:59:04 +00:00
|
|
|
- sed "s/^sha256sums=.*\$/sha256sums=('$SHA_BIN' '$SHA_BASH_COMPLETION' '$SHA_ZSH_COMPLETION' '$SHA_FISH_COMPLETION' '$SHA_LICENSE')/" -i ffsend-bin/PKGBUILD
|
2019-01-12 22:19:11 +00:00
|
|
|
|
2019-03-26 13:06:26 +00:00
|
|
|
# Get SHA hash for local and remote file w/o version, update if it has changed
|
2019-03-27 15:38:12 +00:00
|
|
|
- 'SHA_STRIP_LOCAL=$(cat ffsend-git/PKGBUILD | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)'
|
|
|
|
- 'SHA_STRIP_REMOTE=$(curl -sSL "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=ffsend-git" | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)'
|
2019-03-26 13:06:26 +00:00
|
|
|
|
2019-03-03 17:49:37 +00:00
|
|
|
# Install dependencies
|
2019-01-12 22:19:11 +00:00
|
|
|
- echo "Installing required build packages..."
|
|
|
|
- pacman -Syu --noconfirm sudo base-devel binutils openssh rust cargo cmake git openssl
|
|
|
|
|
2019-03-03 17:49:37 +00:00
|
|
|
# Make AUR package
|
2019-01-12 22:19:11 +00:00
|
|
|
- mkdir -p /.cargo
|
|
|
|
- chmod -R 777 /.cargo
|
2019-03-26 11:36:16 +00:00
|
|
|
- cd ffsend-bin/
|
2019-03-03 17:31:21 +00:00
|
|
|
- echo "Making binary package..."
|
2019-01-12 22:19:11 +00:00
|
|
|
- sudo -u nobody makepkg -c
|
|
|
|
- sudo -u nobody makepkg --printsrcinfo > .SRCINFO
|
2019-03-26 11:36:16 +00:00
|
|
|
- cd ../ffsend
|
|
|
|
- echo "Making main source package..."
|
2019-03-03 17:31:21 +00:00
|
|
|
- sudo -u nobody makepkg -c
|
|
|
|
- sudo -u nobody makepkg --printsrcinfo > .SRCINFO
|
2019-03-26 13:06:26 +00:00
|
|
|
# Make git package if different than the remote
|
|
|
|
- |
|
2019-03-27 15:38:12 +00:00
|
|
|
if [ ! "$SHA_STRIP_LOCAL" == "$SHA_STRIP_REMOTE" ]; then
|
2019-03-26 13:06:26 +00:00
|
|
|
cd ../ffsend-git
|
|
|
|
echo "Making git source package..."
|
|
|
|
sudo -u nobody makepkg -c
|
|
|
|
sudo -u nobody makepkg --printsrcinfo > .SRCINFO
|
|
|
|
else
|
|
|
|
echo "Not making git source package, it has not changed"
|
|
|
|
fi
|
2019-03-03 17:31:21 +00:00
|
|
|
- cd ..
|
2019-01-12 22:19:11 +00:00
|
|
|
|
2019-03-26 11:36:16 +00:00
|
|
|
# Set up SSH for publishing
|
2019-01-12 22:19:11 +00:00
|
|
|
- mkdir -p /root/.ssh
|
|
|
|
- cp ./aur.pub /root/.ssh/id_rsa.pub
|
|
|
|
- echo "$AUR_SSH_PRIVATE" > /root/.ssh/id_rsa
|
|
|
|
- echo "Host aur.archlinux.org" >> /root/.ssh/config
|
|
|
|
- echo " IdentityFile /root/.ssh/aur" >> /root/.ssh/config
|
|
|
|
- echo " User aur" >> /root/.ssh/config
|
|
|
|
- chmod 600 /root/.ssh/{id_rsa*,config}
|
|
|
|
- eval `ssh-agent -s`
|
|
|
|
- ssh-add /root/.ssh/id_rsa
|
|
|
|
- ssh-keyscan -H aur.archlinux.org >> /root/.ssh/known_hosts
|
|
|
|
- git config --global user.name "timvisee"
|
2019-03-03 17:31:21 +00:00
|
|
|
- git config --global user.email "tim@visee.me"
|
|
|
|
|
2019-03-26 11:36:16 +00:00
|
|
|
# Publish main package: clone AUR repo, commit update and push
|
|
|
|
- git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend
|
|
|
|
- cd aur-ffsend
|
|
|
|
- cp ../ffsend/{PKGBUILD,.SRCINFO} ./
|
2019-01-12 22:19:11 +00:00
|
|
|
- git add PKGBUILD .SRCINFO
|
|
|
|
- git commit -m "Release v$VERSION"
|
|
|
|
- git push
|
2019-03-03 17:31:21 +00:00
|
|
|
- cd ..
|
|
|
|
|
2019-03-26 11:36:16 +00:00
|
|
|
# Publish binary package: clone AUR repo, commit update and push
|
|
|
|
- git clone ssh://aur@aur.archlinux.org/ffsend-bin.git aur-ffsend-bin
|
|
|
|
- cd aur-ffsend-bin
|
|
|
|
- cp ../ffsend-bin/{PKGBUILD,.SRCINFO} ./
|
2019-03-03 17:31:21 +00:00
|
|
|
- git add PKGBUILD .SRCINFO
|
|
|
|
- git commit -m "Release v$VERSION"
|
|
|
|
- git push
|
|
|
|
- cd ..
|
2019-01-20 16:37:52 +00:00
|
|
|
|
2019-03-26 12:49:16 +00:00
|
|
|
# Publish git package: clone AUR repo, commit update and push
|
2019-03-26 13:06:26 +00:00
|
|
|
# Only publish it if it is different than the remote
|
|
|
|
- |
|
2019-03-27 15:38:12 +00:00
|
|
|
if [ ! "$SHA_STRIP_LOCAL" == "$SHA_STRIP_REMOTE" ]; then
|
2019-03-27 17:13:27 +00:00
|
|
|
git clone ssh://aur@aur.archlinux.org/ffsend-git.git aur-ffsend-git
|
2019-03-26 13:06:26 +00:00
|
|
|
cd aur-ffsend-git
|
|
|
|
cp ../ffsend-git/{PKGBUILD,.SRCINFO} ./
|
|
|
|
git add PKGBUILD .SRCINFO
|
|
|
|
git commit -m "Update PKGBUILD for release v$VERSION"
|
|
|
|
git push
|
|
|
|
cd ..
|
|
|
|
else
|
|
|
|
echo "Not pushing git package, it has not changed"
|
|
|
|
fi
|
2019-03-26 11:36:16 +00:00
|
|
|
|
2019-03-03 17:31:21 +00:00
|
|
|
# TODO: add job to test ffsend{-git} AUR packages
|