Skip to content

Commit

Permalink
Build snapcraft artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow committed Jun 17, 2021
1 parent ac978ad commit 1ed7811
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 28 deletions.
55 changes: 47 additions & 8 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
- "go.sum"
workflow_dispatch:

env:
PRODUCT: wayback

jobs:
build:
name: Build
Expand Down Expand Up @@ -118,13 +121,13 @@ jobs:
ARGS="${ARGS}-${GOMIPSLE}"
fi
make ${ARGS}
echo "::set-output name=filename::wayback-${ARGS}"
echo "::set-output name=filename::${{ env.PRODUCT }}-${ARGS}"
- name: Upload binary artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ steps.builder.outputs.filename }}
path: ./build/binary/wayback*
path: ./build/binary/${{ env.PRODUCT }}*
if-no-files-found: error

debpkg:
Expand Down Expand Up @@ -164,13 +167,13 @@ jobs:
PKG_ARCH="${TARGET//v8}"
PKG_ARCH="${PKG_ARCH//32}"
make debian DEB_IMG_ARCH=${TARGET} PKG_ARCH=${PKG_ARCH}
echo "::set-output name=filename::wayback-deb-${PKG_ARCH}"
echo "::set-output name=filename::${{ env.PRODUCT }}-deb-${PKG_ARCH}"
- name: Upload archived binary
uses: actions/upload-artifact@v2
with:
name: ${{ steps.builder.outputs.filename }}
path: build/package/wayback*.deb
path: build/package/${{ env.PRODUCT }}*.deb
if-no-files-found: error

rpmpkg:
Expand All @@ -188,8 +191,8 @@ jobs:
- name: Upload archived binary
uses: actions/upload-artifact@v2
with:
name: wayback-rpm
path: build/package/wayback*.rpm
name: ${{ env.PRODUCT }}-rpm
path: build/package/${{ env.PRODUCT }}*.rpm
if-no-files-found: error

aurpkg:
Expand All @@ -211,10 +214,46 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wayback-aur
name: ${{ env.PRODUCT }}-aur
path: |
build/aur/.SRCINFO
build/aur/PKGBUILD
build/aur/wayback*.pkg.tar.zst
build/aur/${{ env.PRODUCT }}*.pkg.tar.zst
if-no-files-found: error

snapcraft:
name: Build snap
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- i386
- amd64
steps:
- name: Check out code base
if: github.event_name == 'push'
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Check out code base
if: github.event_name == 'pull_request'
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- id: build
name: Build snap
uses: diddlesnaps/snapcraft-multiarch-action@v1
with:
architecture: ${{ matrix.platform }}
snapcraft-channel: stable

- uses: actions/upload-artifact@v2
with:
name: ${{ env.PRODUCT }}-snap-${{ matrix.platform }}
path: ${{ steps.build.outputs.snap }}
77 changes: 58 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

env:
PRODUCT: wayback

jobs:
build:
name: Build
Expand Down Expand Up @@ -101,8 +104,8 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wayback
path: build/package/wayback*
name: ${{ env.PRODUCT }}
path: build/package/${{ env.PRODUCT }}*

debpkg:
name: Build DEB
Expand Down Expand Up @@ -146,8 +149,8 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wayback
path: build/package/wayback*.deb
name: ${{ env.PRODUCT }}
path: build/package/${{ env.PRODUCT }}*.deb

rpmpkg:
name: Build RPM
Expand All @@ -164,8 +167,8 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wayback
path: build/package/wayback*.rpm
name: ${{ env.PRODUCT }}
path: build/package/${{ env.PRODUCT }}*.rpm

aurpkg:
name: Build AUR
Expand All @@ -186,13 +189,49 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: wayback
name: ${{ env.PRODUCT }}
path: |
build/aur/.SRCINFO
build/aur/PKGBUILD
build/aur/wayback*.pkg.tar.zst
build/aur/${{ env.PRODUCT }}*.pkg.tar.zst
if-no-files-found: error

snapcraft:
name: Build Snap
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- amd64
steps:
- name: Check out code base
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- id: build
name: Build snap
uses: diddlesnaps/snapcraft-multiarch-action@v1
with:
architecture: ${{ matrix.platform }}
snapcraft-channel: stable

- name: Set env & Print wayback version
shell: bash
run: |
version=$(git describe --tags `git rev-list --tags --max-count=1` | sed -e 's/v//g')
echo "VERSION=${version:1}" >> $GITHUB_ENV
echo ${{ steps.build.outputs.snap }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.PRODUCT }}
path: ${{ steps.build.outputs.snap }}

checksum:
name: Get archived packages checksum
runs-on: ubuntu-latest
Expand All @@ -203,13 +242,13 @@ jobs:
- name: Download math result from build job
uses: actions/download-artifact@v2
with:
name: wayback
name: ${{ env.PRODUCT }}
path: .

- name: Create all binary digest
id: digest
run: |
digest=$(find wayback* -type f -exec sha256sum {} +)
digest=$(find ${{ env.PRODUCT }}* -type f -exec sha256sum {} +)
digest="${digest//$'%'/%25}"
digest="${digest//$'\n'/%0A}"
echo "::set-output name=result::$digest"
Expand Down Expand Up @@ -254,8 +293,8 @@ jobs:
- name: Download math result from build and checksum jobs
uses: actions/download-artifact@v2
with:
name: wayback
path: wayback # Put files to wayback directory
name: ${{ env.PRODUCT }}
path: ${{ env.PRODUCT }}

- name: Create Release
uses: softprops/action-gh-release@v1
Expand All @@ -264,7 +303,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
body_path: gittaglogs.txt
files: wayback/wayback*
files: ${{ env.PRODUCT }}/${{ env.PRODUCT }}*
draft: true

release-apt:
Expand All @@ -282,8 +321,8 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: wayback
path: wayback # Put files to wayback directory
name: ${{ env.PRODUCT }}
path: ${{ env.PRODUCT }}

- name: Import GPG key
id: gpg
Expand All @@ -302,7 +341,7 @@ jobs:
- name: Build APT Repository
if: ${{ steps.gpg.outputs.keyid != '' }}
run: |
cp ./wayback/*.deb .
cp ./${{ env.PRODUCT }}/*.deb .
make build
- name: Publish APT Repository
Expand All @@ -328,12 +367,12 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: wayback
path: wayback # Put files to wayback directory
name: ${{ env.PRODUCT }}
path: ${{ env.PRODUCT }}

- name: Build RPM Repository
run: |
cp ./wayback/*.rpm ./x86_64
cp ./${{ env.PRODUCT }}/*.rpm ./x86_64
make build
- name: Publish RPM Repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snapcraft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- uses: actions/upload-artifact@v2
with:
name: snap
name: snap-${{ matrix.platform }}
path: ${{ steps.build.outputs.snap }}

- uses: snapcore/action-publish@v1
Expand Down
2 changes: 2 additions & 0 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ parts:
apps:
wayback:
command: wayback
plugs:
- network

0 comments on commit 1ed7811

Please sign in to comment.