diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..583decf --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000..13c1937 --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,5 @@ +# inherits settings from https://github.com/Manjaro-Sway/.github/blob/main/.github/settings.yml +_extends: .github +repository: + homepage: "https://git.hya.sk/skia/swaysome.git" +# you can extend settings using https://probot.github.io/apps/settings/ diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml new file mode 100644 index 0000000..fee139e --- /dev/null +++ b/.github/workflows/bootstrap.yml @@ -0,0 +1,20 @@ +name: bootstrap +on: + workflow_dispatch: + schedule: + - cron: '0 1-23/2 * * *' + +jobs: + botstrap_actions: + runs-on: ubuntu-latest + steps: + - + name: checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.BOOTSTRAP_WORKFLOWS }} + - + id: bootstrap + uses: Manjaro-Sway/bootstrap-package-actions@master + with: + upstream: "https://git.hya.sk/skia/swaysome.git" diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml new file mode 100644 index 0000000..5951891 --- /dev/null +++ b/.github/workflows/contributors.yml @@ -0,0 +1,23 @@ +name: "forward-all-contributors" +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + +jobs: + add-contributors: + runs-on: ubuntu-latest + steps: + - name: check user has write access + uses: lannonbr/repo-permission-check-action@2.0.2 + with: + permission: "write" + - name: create comment in target repo + uses: peter-evans/create-or-update-comment@v1 + if: contains(github.event.comment.body, '@all-contributors') + with: + issue-number: 73 + repository: manjaro-sway/manjaro-sway + body: ${{ github.event.comment.body }} + token: ${{ secrets.PUSH_AND_TRIGGER }} \ No newline at end of file diff --git a/.github/workflows/increment-rel.yml b/.github/workflows/increment-rel.yml new file mode 100644 index 0000000..3a1020e --- /dev/null +++ b/.github/workflows/increment-rel.yml @@ -0,0 +1,34 @@ +name: increment pkgrel + +on: + workflow_dispatch: + inputs: + pkgrel: + description: 'pkgrel to set - will iterate if not given' + required: false + +jobs: + increment: + runs-on: ubuntu-latest + steps: + - + name: checkout + uses: actions/checkout@v2.3.4 + with: + token: ${{ secrets.PUSH_AND_TRIGGER }} + - + name: increment_rel + run: | + CURRENT_VERSION=$(cat PKGBUILD | grep pkgrel | sed -e 's/^pkgrel=//') + INPUT_VERSION=${{ github.event.inputs.pkgrel }} + NEXT_VERSION=$((CURRENT_VERSION + 1)) + sed -i "/pkgrel=/c\pkgrel=${INPUT_VERSION:-${NEXT_VERSION}}" PKGBUILD + + git config user.name increment-version-action + git config user.email info@manjaro-sway.download + - + name: commit + run: | + git add PKGBUILD + git commit -m "release: increment rel" + git push \ No newline at end of file diff --git a/.github/workflows/pkgbuild.yml b/.github/workflows/pkgbuild.yml new file mode 100644 index 0000000..4dc38ce --- /dev/null +++ b/.github/workflows/pkgbuild.yml @@ -0,0 +1,107 @@ +name: pkgbuild + +on: + workflow_dispatch: + push: + branches: + - master + - main + +jobs: + prepare: + runs-on: ubuntu-20.04 + name: prepare + steps: + - uses: actions/checkout@v2.3.4 + - name: check-updatable + id: check + run: | + VERSION=$(cat PKGBUILD | grep pkgver= | sed -e 's/^pkgver=//' | awk '{print $1}')-$(cat PKGBUILD | grep pkgrel= | sed -e 's/^pkgrel=//' | awk '{print $1}') + echo "ARCHITECTURES=$(cat PKGBUILD | grep arch= | sed -e 's/^arch=(\(.*\))/\1/')" >>$GITHUB_ENV + echo "VERSION=${VERSION}" >>$GITHUB_ENV + git fetch --tags + git rev-list "${VERSION}" >/dev/null && \ + echo "::set-output name=updatable::false" || \ + echo "::set-output name=updatable::true" + outputs: + updatable: ${{ steps.check.outputs.updatable }} + architectures: ${{ env.ARCHITECTURES }} + version: ${{ env.VERSION }} + pkgbuild: + runs-on: ubuntu-20.04 + name: ${{ matrix.distro }} ${{ matrix.arch }} + needs: [prepare] + if: ${{ needs.prepare.outputs.updatable == 'true' }} + strategy: + matrix: + include: + - arch: aarch64 + distro: manjaro_latest + archlinux_arch: aarch64 + - arch: amd64 + distro: manjaro_latest + archlinux_arch: x86_64 + steps: + - uses: actions/checkout@v2.3.4 + - name: get-additional-gpg + run: | + echo ${{ secrets.GPG_KEYID }} >>.github/additional_gpg + echo "ADDITIONAL_GPG=$(cat .github/additional_gpg)" >>$GITHUB_ENV + - name: any-build + if: ${{ ( contains(needs.prepare.outputs.architectures, 'any') && matrix.archlinux_arch == 'x86_64' ) }} + run: echo "BUILD=true" >>$GITHUB_ENV + - name: arch-build + if: ${{ contains(needs.prepare.outputs.architectures, matrix.archlinux_arch) }} + run: echo "BUILD=true" >>$GITHUB_ENV + - uses: Manjaro-Sway/run-on-arch-action@master + if: ${{ env.BUILD == 'true' }} + name: build + id: build + with: + arch: ${{ matrix.arch }} + distro: ${{ matrix.distro }} + githubToken: ${{ github.token }} + setup: | + mkdir -p "${PWD}/artifacts" + dockerRunArgs: | + --volume "${PWD}/artifacts:/artifacts" + --cap-add=SYS_ADMIN + shell: /bin/sh + install: | + for key in "${{ env.ADDITIONAL_GPG }}";do + sudo -u builder gpg --keyserver keys.openpgp.org --recv-key $key + done + sudo -u builder gpg --keyserver keys.openpgp.org --recv-key ${{ secrets.GPG_KEYID }} + pacman-key --keyserver keys.openpgp.org --recv-keys ${{ secrets.GPG_KEYID }} + + sed -i '/^\[core\]/i \[manjaro-sway\]\nSigLevel = Optional TrustAll\nServer = https://packages.manjaro-sway.download/$arch\n' /etc/pacman.conf + pacman-mirrors --geoip + run: | + pacman -Syy + chown builder $PWD + sudo -u builder makepkg -fsAc --noconfirm --noprogressbar + cp *.pkg.tar.zst* /artifacts/ + - name: determine-filename + if: ${{ env.BUILD == 'true' }} + run: echo "FILE_NAME=$(basename $(find ./artifacts/ -type f \( -name "*.pkg.tar.zst" \)))" >> $GITHUB_ENV + - name: sign + if: ${{ env.BUILD == 'true' }} + run: | + # import signing key (no passphrase) + cat <(echo -e "${{ secrets.GPG_SECRET_KEY_BASE64 }}" | base64 --decode) | gpg --batch --import + gpg --pinentry-mode loopback --detach-sign ./artifacts/${{ env.FILE_NAME }} + - name: release + if: ${{ env.BUILD == 'true' }} + run: | + echo ${{ github.token }} | gh auth login --with-token + gh release create ${{ needs.prepare.outputs.version }} --repo ${{ github.repository }} --notes "automated release" || echo "release already exists" + gh release upload ${{ needs.prepare.outputs.version }} --repo ${{ github.repository }} --clobber \ + ./artifacts/${{ env.FILE_NAME }} ./artifacts/${{ env.FILE_NAME }}.sig + - name: dispatch + if: ${{ env.BUILD == 'true' }} + uses: peter-evans/repository-dispatch@v1 + with: + token: ${{ secrets.DISPATCH }} + repository: manjaro-sway/packages + event-type: package_update + client-payload: '{ "repository": "${{ github.repository }}", "version": "${{ needs.prepare.outputs.version }}", "file_name": "${{ env.FILE_NAME }}"}' diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml new file mode 100644 index 0000000..70091d9 --- /dev/null +++ b/.github/workflows/rebase.yml @@ -0,0 +1,38 @@ +name: rebase + +on: + workflow_dispatch: + schedule: + - cron: '*/30 * * * *' + +env: + UPSTREAM_GIT: "" + +jobs: + rebase: + runs-on: ubuntu-latest + steps: + - + name: checkout + uses: actions/checkout@v2.3.4 + with: + token: ${{ secrets.PUSH_AND_TRIGGER }} + - + name: add ssh pk + if: ${{ contains(env.UPSTREAM_GIT, 'ssh') }} + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_BASE64 }}" | base64 -d >~/.ssh/id_rsa && chmod 400 ~/.ssh/id_rsa + [ -f .github/additional_known_hosts ] && cat .github/additional_known_hosts >> ~/.ssh/known_hosts + - + name: check if behind upstream + run: | + git remote add upstream ${UPSTREAM_GIT} + git fetch upstream + git merge-base --is-ancestor $(git branch --show-current) upstream/$(git branch --show-current) && exit 1 || exit 0 + - + name: rebase + if: ${{ failure() }} + run: | + git rebase upstream/$(git branch --show-current) + git push --force-with-lease diff --git a/.github/workflows/resubmit.yml b/.github/workflows/resubmit.yml new file mode 100644 index 0000000..de98992 --- /dev/null +++ b/.github/workflows/resubmit.yml @@ -0,0 +1,43 @@ +name: resubmit the release + +on: + workflow_dispatch: + schedule: + - cron: '20 1-23/2 * * *' + +jobs: + resubmit: + runs-on: ubuntu-latest + steps: + - name: determine skip + run: | + if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" || $(( RANDOM % 6 )) == 0 ]]; + then + echo "SKIP=false" >> $GITHUB_ENV + fi + - + id: version + if: ${{ env.SKIP == 'false' }} + run: | + LATEST_INFO=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest") + echo "::set-output name=file-name-aarch64::$(echo $LATEST_INFO | jq -r '.assets[].name' | grep aarch64)" + echo "::set-output name=file-name-x86_64::$(echo $LATEST_INFO | jq -r '.assets[].name' | grep -E -i -w '(x86_64|any)')" + echo "VERSION=$(echo $LATEST_INFO | jq -r '.tag_name')" >> $GITHUB_ENV + - + name: dispatch_aarch64 + if: ${{ env.SKIP == 'false' && steps.version.outputs.file-name-aarch64 != '' }} + uses: peter-evans/repository-dispatch@v1 + with: + token: ${{ secrets.DISPATCH }} + repository: manjaro-sway/packages + event-type: package_update + client-payload: '{ "repository": "${{ github.repository }}", "version": "${{ env.VERSION }}", "file_name": "${{ steps.version.outputs.file-name-aarch64 }}"}' + - + name: dispatch_x86_64 + if: ${{ env.SKIP == 'false' && steps.version.outputs.file-name-x86_64 != '' }} + uses: peter-evans/repository-dispatch@v1 + with: + token: ${{ secrets.DISPATCH }} + repository: manjaro-sway/packages + event-type: package_update + client-payload: '{ "repository": "${{ github.repository }}", "version": "${{ env.VERSION }}", "file_name": "${{ steps.version.outputs.file-name-x86_64 }}"}' \ No newline at end of file diff --git a/.github/workflows/set-version.yml b/.github/workflows/set-version.yml new file mode 100644 index 0000000..f6213fe --- /dev/null +++ b/.github/workflows/set-version.yml @@ -0,0 +1,32 @@ +name: set version to src version + +on: + repository_dispatch: + types: [source_update] + +jobs: + update-version: + runs-on: ubuntu-latest + steps: + - + name: check out the repo + id: checkout_repo + uses: actions/checkout@v2.3.4 + with: + token: ${{ secrets.PUSH_AND_TRIGGER }} + - + name: update pkgbuild + env: + VERSION: ${{ github.event.client_payload.version }} + MD5: ${{ github.event.client_payload.md5 }} + run: | + [ -n "$VERSION" ] && sed -i "/pkgver=/c\pkgver=${VERSION}" PKGBUILD || exit 0 + [ -n "$MD5" ] && sed -i "/_sourcemd5=/c\_sourcemd5=${MD5}" PKGBUILD || exit 0 + - + name: commit + run: | + git config --global user.name "Repo Update Bot" + git config --global user.email "info@manjaro-sway.download" + git add PKGBUILD + git commit -m "chore: release version ${{ github.event.client_payload.version }}" + git push \ No newline at end of file diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..b2f48e6 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,23 @@ +# Maintainer: Jonas Strasel + +pkgname="swaysome" +pkgver=1.0.64 +pkgrel=0 +pkgdesc="This binary helps you configure sway to work a bit more like Awesome. This currently means workspaces that are name-spaced on a per-screen basis." +arch=("x86_64" "aarch64") +url="https://git.hya.sk/skia/$pkgname" +license=("none") +makedepends=("rust" "cargo" "git") +_commit="60fdf90d4d4ab075b4eb4121c09ea9ef855df109" +source=("$pkgname-$pkgver.tar.gz::$url/archive/$_commit.tar.gz") +sha256sums=('2538fe7783219a692fd7b9449f8482f53697988e4859e1962545bae9f353d904') + +build() { + cd "$srcdir/$pkgname" + cargo build --release --locked +} + +package() { + install -D -m755 "$srcdir/$pkgname/target/release/$pkgname" "$pkgdir/usr/bin/sworkstyle" + # install -D -m644 "$srcdir/$pkgname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +}