Update sed command for getting vlan_id from cmdline: (#181) #43
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: For each PR and Push | |
on: | |
pull_request: | |
push: | |
jobs: | |
validation: | |
runs-on: ubuntu-20.04 | |
outputs: | |
commitid: ${{steps.commitid.outputs.short}} | |
steps: | |
- name: Setup Dynamic Env | |
run: | | |
echo "MAKEFLAGS=-j$(nproc)" | tee $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to quay.io | |
if: github.ref == 'refs/heads/main' | |
uses: docker/login-action@v1 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Figure Out Commit Short ID | |
id: commitid | |
run: | | |
echo ::set-output name=short::$(git rev-parse --short HEAD) | |
- name: Install nix | |
uses: cachix/install-nix-action@v22 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Fetch Nix Deps | |
run: nix-shell --command true | |
- name: Run formatters and linters | |
run: nix-shell --run .github/workflows/formatters-and-linters.sh | |
- name: Build Hook Tarballs | |
run: | | |
# fixes "write /run/user/1001/355792648: no space left on device" error | |
sudo mount -o remount,size=3G /run/user/1001 || true | |
nix-shell --run 'make TAG=${{steps.commitid.outputs.short}} dist' | |
- name: Publish Hook | |
if: github.ref == 'refs/heads/main' | |
run: | | |
# Build and push the container images | |
nix-shell --run 'make TAG=${{steps.commitid.outputs.short}} push' | |
nix-shell --run 'make TAG=latest push' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: hook-${{steps.commitid.outputs.short}} | |
path: out/${{steps.commitid.outputs.short}}/rel/hook_*.tar.gz | |
publish-release-latest: | |
runs-on: ubuntu-20.04 | |
if: github.ref == 'refs/heads/main' | |
needs: validation | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: hook-${{needs.validation.outputs.commitid}} | |
- name: Delete Tag | |
run: | | |
git tag -d latest || echo "no local tag to delete" | |
git push origin :latest -f || echo "no remote tag to delete" | |
- name: Generate Release Notes | |
run: | | |
generated_release_notes=$(gh api 'repos/{owner}/{repo}/releases/generate-notes' -F tag_name=latest --jq .body) | |
cat >>"$GITHUB_ENV" <<-EOF | |
RELEASE_NOTES<<RELEASE_NOTES_EOF | |
# :warning: :rotating_light: :boom: Note!!! :boom: :rotating_light: :warning: | |
The uploaded files will be updated on the next merge to main, as such download them before use to avoid surprises. | |
--- | |
Commit: ${{needs.validation.outputs.commitid}} | |
--- | |
$generated_release_notes | |
RELEASE_NOTES_EOF | |
EOF | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Update Tag | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: latest | |
message: "Latest development build" | |
- name: Update latest release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Hook Latest Development Build | |
body: ${{env.RELEASE_NOTES}} | |
files: hook_*.tar.gz | |
prerelease: true | |
tag_name: latest | |
publish-release-tag: | |
runs-on: ubuntu-20.04 | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: validation | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: hook-${{needs.validation.outputs.commitid}} | |
- name: Generate Release Notes | |
run: | | |
generated_release_notes=$(gh api 'repos/{owner}/{repo}/releases/generate-notes' -F tag_name=${{github.ref}} --jq .body) | |
cat >>"$GITHUB_ENV" <<-EOF | |
RELEASE_NOTES<<RELEASE_NOTES_EOF | |
$generated_release_notes | |
RELEASE_NOTES_EOF | |
EOF | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Update latest release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body: ${{env.RELEASE_NOTES}} | |
files: hook_*.tar.gz |