Skip to content

Commit

Permalink
add build job for branches
Browse files Browse the repository at this point in the history
  • Loading branch information
hickey committed Feb 20, 2024
1 parent 042b2db commit 2a7b5b1
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 26 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build-packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build MeshChat Packages
on: push

jobs:
calculate-version:
runs-on: ubuntu-latest
outputs:
build_version: ${{ steps.build-version-slug.outputs.build_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: build-version-slug
run: |
date=$(date +%Y%m%d)
branch="${GITHUB_REF_NAME}"
commit=$(git rev-parse --short HEAD)
version="${date}-${branch}-${commit}"
echo "build_version=$version" >> $GITHUB_OUTPUT
build-meshchat-package:
needs: calculate-version
uses:
./.github/workflows/workflow-meshchat-package.yaml
with:
build_version: ${{ needs.calculate-version.outputs.build_version }}
build_dir: package/meshchat-ipkg

build-meshchat-api-package:
needs: calculate-version
uses:
./.github/workflows/workflow-meshchat-api-package.yaml
with:
build_version: ${{ needs.calculate-version.outputs.build_version }}
build_dir: package/meshchat-ipkg
4 changes: 2 additions & 2 deletions .github/workflows/release-meshchat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
build-meshchat-package:
needs: create-release
uses:
./.github/workflows/build-meshchat-package.yaml
./.github/workflows/workflow-meshchat-package.yaml
with:
ref: release
build_version: ${{ needs.create-release.outputs.build_version }}
Expand All @@ -39,7 +39,7 @@ jobs:
build-meshchat-api-package:
needs: create-release
uses:
./.github/workflows/build-meshchat-api-package.yaml
./.github/workflows/workflow-meshchat-api-package.yaml
with:
build_version: ${{ needs.create-release.outputs.build_version }}
build_dir: package/meshchat-ipkg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
ref:
required: false
type: string
default: $GITHUB_REF_NAME
default: ${{ github.ref_name }}

jobs:
create-meshchat-package:
Expand Down
23 changes: 0 additions & 23 deletions package/update-version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
#!/bin/bash

# This script runs from the top of the project directory and
Expand Down Expand Up @@ -45,25 +44,3 @@ sed -i "s/^Version:.*/Version: $version/" $IPK_DIR/CONTROL/control
if [[ -f $IPK_DIR/www/cgi-bin/meshchatconfig.lua ]]; then
sed -i "s/^app_version.*$/app_version = \"${version}\"/" $IPK_DIR/www/cgi-bin/meshchatconfig.lua
fi
||||||| parent of 36f653c (Added beginnings of package building code)
=======
#!/bin/bash

# This script runs from the top of the project directory and
# updates the version number in the control file for the package
# being built.

IPK_DIR=$1

if [ "$GITHUB_REF_TYPE" == 'tag' ]; then
# ideally should only get version tags
if [ ${GITHUB_REF_NAME} : "v[0-9]" ]; then
version="${GITHUB_REF_NAME#v}"
fi
else
# branch gets date code
version=$(date +%Y%m%d)
fi

sed -i "s/^Version:.*/Version: $version/" $IPK_DIR/CONTROL/control
>>>>>>> 36f653c (Added beginnings of package building code)

0 comments on commit 2a7b5b1

Please sign in to comment.