edge #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: edge | |
on: | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
# vergoh/vnstat triggers builds on change and once per month | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run ShellCheck | |
uses: ludeeus/action-shellcheck@master | |
with: | |
scandir: './snap/hooks' | |
- name: Check spelling | |
uses: crate-ci/typos@master | |
with: | |
files: ./README* ./snap/*.yaml ./snap/hooks/* | |
isolated: true | |
trigger: | |
needs: [lint] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git remote add deploy git+ssh://[email protected]/~vergo/+git/vnstat-snap | |
- name: Setup ssh | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Setup git.launchpad.net as known host | |
env: | |
GIT_LAUNCHPAD_HOST: ${{ secrets.GIT_LAUNCHPAD_NET_SSH }} | |
run: echo "$GIT_LAUNCHPAD_HOST" >>~/.ssh/known_hosts | |
- name: Discover current snap commit | |
run: | | |
echo "SNAP_COMMIT=$(git rev-parse --short=1 "$GITHUB_SHA")" >>$GITHUB_ENV | |
- name: Setup build details for edge | |
shell: bash | |
run: | | |
git checkout -b edge | |
sed -i -e "s/::g')\"\$/::g')-$SNAP_COMMIT\"/g" snap/snapcraft.yaml | |
echo "# timestamp: $(date +"%F %X")" >>snap/snapcraft.yaml | |
git diff | |
git commit -a -m "GitHub $GITHUB_REPOSITORY $GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER" | |
- name: Build test | |
uses: snapcore/action-build@v1 | |
id: snapcraft | |
- name: Install test | |
run: | | |
sudo snap install --dangerous ${{ steps.snapcraft.outputs.snap }} | |
vnstat --version | |
- name: Push changes | |
run: | | |
git push deploy edge --force |