Skip to content

Commit

Permalink
Merge pull request #1 from BenMMcLean/mclean/feature/update-version-t…
Browse files Browse the repository at this point in the history
…o-lemmy

Prepend library version with lemmy version
  • Loading branch information
emilymclean authored Jul 10, 2024
2 parents 99112e6 + 41469a0 commit 887da24
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 134 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
amends "pkl/build.pkl"
import "pkl/src/common.pkl" as common

projectName = "jlemmy"

local b = (import("pkl/build.pkl")) {
projectName = "jlemmy"
}

jobs = (b.jobs) {
["version"] = new Job {
outputs = new Mapping {
["version"] = "${{ steps.version.outputs.version }}"
}
steps = new Listing {
(common.checkout) {
with = new Mapping {
["fetch-depth"] = 0
["submodules"] = true
}
}
new CommandStep {
id = "version"
run = """
regex='"version": "(.*)",'
contents="$(cat ./type-generator/lemmy-js-client/package.json | grep "version")"
if [[ $contents =~ $regex ]]
then
echo ${BASH_REMATCH[1]}
echo "version=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
else
echo Zoinks Scoob!
exit 1;
fi
"""
}
}
}
["release"] = new Job {
needs = new Listing {
"version"
}
`if` = "${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}"
permissions = new Mapping {
["contents"] = "write"
}
outputs = new Mapping {
["upload_url"] = "${{ steps.create_release.outputs.upload_url }}"
}
steps = new Listing {
common.checkout
common.create_release
}
}
}
30 changes: 15 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gitversion.outputs.semVer }}
versionCode: ${{ steps.run_number.outputs.versionCode }}
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.6
with:
versionSpec: 5.x
- id: gitversion
name: Use GitVersion
uses: gittools/actions/gitversion/execute@v0.9.6
with:
useConfigFile: true
configFilePath: ./gitversion.yml
- name: Display SemVer
run: 'echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"'
submodules: true
- id: version
run: |-
regex='"version": "(.*)",'
contents="$(cat ./type-generator/lemmy-js-client/package.json | grep "version")"
if [[ $contents =~ $regex ]]
then
echo ${BASH_REMATCH[1]}
echo "version=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
else
echo Zoinks Scoob!
exit 1;
fi
build:
needs:
- version
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
contents: write
needs:
- version
if: github.event_name != 'pull_request'
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/workflows.pkl
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
amends "pkl/render.pkl"

workflows = new Listing {
(import("pkl/build.pkl")) {
projectName = "jlemmy"
}
import("build.pkl")
import("pkl/test.pkl")
import("update-types.pkl")
}
3 changes: 1 addition & 2 deletions build-pkl.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pkl eval -m .github/workflows .github/workflows/workflows.pkl
pkl eval -f yaml -o gitversion.yml gitversion.pkl
pkl eval -m .github/workflows .github/workflows/workflows.pkl
1 change: 0 additions & 1 deletion gitversion.pkl

This file was deleted.

113 changes: 0 additions & 113 deletions gitversion.yml

This file was deleted.

0 comments on commit 887da24

Please sign in to comment.