Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
stylesuxx committed May 1, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
0 parents commit 6a748f5
Showing 7 changed files with 106 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build and release

on:
push:
branches: [ master ]
tags:
- '*'

workflow_dispatch:

jobs:
release:
name: Release ipk to GitHub Releases
runs-on: ubuntu-latest
permissions:
contents: write
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}

- name: View content
run: ls -R

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Create master push pre-release
if: ${{ env.RELEASE_VERSION == 'master' }}
id: create_pre_release
uses: ncipollo/release-action@v1
with:
tag: push-run-${{ github.run_number }}
name: push-run-${{ github.run_number }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
artifacts: ./*/*.ipk

- name: Create tagged release
if: ${{ env.RELEASE_VERSION != 'master' }}
id: create_release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
artifacts: ./*/*.ipk

build:
name: Build IPK package
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Get GitHub Build Number (ENV)
id: get_buildno
run: echo "GITHUBBUILDNUMBER=${{ github.run_number }}" >> $GITHUB_ENV
continue-on-error: true

- name: Make artifact name
id: make_artifactname
run: |
ARTIFACT_NAME="EXAMPLE-IPK-BUILD-${{ github.run_number }}"
echo "${ARTIFACT_NAME}"
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
- name: Build ipk package
run: make

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./ipk/*.ipk
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipk
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
NAME = $(shell cat ./control/control | grep Package | cut -d" " -f2)
ARCH = $(shell cat ./control/control | grep Architecture | cut -d" " -f2)
VERSION = $(shell cat ./control/control | grep Version | cut -d" " -f2)
IPK_NAME = "${NAME}_${VERSION}_${ARCH}.ipk"

all:

mkdir -p ipk
echo "2.0" > ipk/debian-binary
cp -r data ipk/
cp -r control ipk/
cd ipk/control && tar czvf ../control.tar.gz .
cd ipk/data && tar czvf ../data.tar.gz .
cd ipk/ && tar czvf "./${IPK_NAME}" ./control.tar.gz ./data.tar.gz ./debian-binary

clean:
rm -rf ipk
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Example IPK builder
This repo is meant as an example regarding workflows and IPK's.

The `Makefile` is used to build an IPK from the available data. The workflow file is meant to create a new release as soon as a new tag is pushed to the repository. It will thus trigger building the IPK and attaching it to the release.
5 changes: 5 additions & 0 deletions control/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Package: test-package
Version: 0.0.1
Maintainer: Your Name <user@example.com>
Description: This is just a test package
Architecture: armv7-3.2
Empty file added data/bin/.keep
Empty file.
Empty file added data/opt/etc/.keep
Empty file.

0 comments on commit 6a748f5

Please sign in to comment.