diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3ea75370..1425246b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -8,54 +8,68 @@ on: jobs: publish-github: name: Publish on GitHub - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: matrix: - TARGET: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl] + build: [linux-gnu, linux-musl] + include: + - build: linux-gnu + os: ubuntu-18.04 + toolchain: stable + target: x86_64-unknown-linux-gnu + - build: linux-musl + os: ubuntu-18.04 + toolchain: stable + target: x86_64-unknown-linux-musl steps: - name: Checkout repository uses: actions/checkout@master - name: Set release version run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV - - name: Install packages + - name: Install packages (linux) + if: matrix.os == 'ubuntu-18.04' run: | sudo apt-get update sudo apt-get install -y --no-install-recommends --allow-unauthenticated libx11-dev musl-tools - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: stable - target: ${{ matrix.TARGET }} + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} override: true - name: Build the project - run: PKG_CONFIG_ALLOW_CROSS=1 cargo build --release --locked --target ${{ matrix.TARGET }} + run: PKG_CONFIG_ALLOW_CROSS=1 cargo build --verbose --release --locked --target ${{ matrix.target }} - name: Prepare assets run: | mkdir assets - cp -t assets/ target/${{ matrix.TARGET }}/release/menyoki && strip -s assets/menyoki cp -t assets/ LICENSE README.md CHANGELOG.md - cp -t assets/ --parents man/* cp -t assets/ --parents completions/* && rm -f assets/completions/generate.sh cp -t assets/ --parents config/menyoki.conf - mv assets/ menyoki-${{ env.RELEASE_VERSION }}/ - tar -czvf menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz menyoki-${{ env.RELEASE_VERSION }} - sha512sum menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz > menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz.sha512 - echo "${{ secrets.GPG_RELEASE_KEY }}" | base64 --decode > release.key - echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --pinentry-mode=loopback --passphrase-fd 0 --import release.key - echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --pinentry-mode=loopback --passphrase-fd 0 --detach-sign menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz - - name: Upload assets + if [ "${{ matrix.os }}" = "ubuntu-18.04" ]; then + cp -t assets/ --parents man/* + cp -t assets/ target/${{ matrix.TARGET }}/release/menyoki && strip -s assets/menyoki + mv assets/ menyoki-${{ env.RELEASE_VERSION }}/ + tar -czvf menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz menyoki-${{ env.RELEASE_VERSION }} + sha512sum menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz > menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz.sha512 + echo "${{ secrets.GPG_RELEASE_KEY }}" | base64 --decode > release.key + echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --pinentry-mode=loopback --passphrase-fd 0 --import release.key + echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --pinentry-mode=loopback --passphrase-fd 0 --detach-sign menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz + fi + - name: Upload assets (linux) + if: matrix.os == 'ubuntu-18.04' uses: softprops/action-gh-release@v1 with: files: | - menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz - menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz.sig - menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz.sha512 + menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz + menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz.sig + menyoki-${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz.sha512 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} publish-crates-io: name: Publish on crates.io - runs-on: ubuntu-latest + needs: ['publish-github'] + runs-on: ubuntu-18.04 steps: - name: Checkout repository uses: actions/checkout@master diff --git a/CHANGELOG.md b/CHANGELOG.md index 94a68744..693c00fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support [slop](https://github.com/naelstrof/slop) via `--size $(slop)` for area selection - Add blank implementation for other platforms +### Changed +- Update CD workflow for building for other platforms + ### Fixed - Prevent abort on cancelling record/capture ([#3](https://github.com/orhun/menyoki/issues/3)) - Check if RGBA color is valid while colorizing the report