Skip to content

Commit

Permalink
updated workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 5, 2023
1 parent 189114b commit fbeb7a1
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 45 deletions.
26 changes: 19 additions & 7 deletions .github/scripts/save-stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@ mkdir $package_dir

unzip -q $PROJECT_NAME-$PLATFORM-$VERSION.zip

"$package_dir/pharo/bin/pharo" --headless $package_dir/image/$PROJECT_NAME.image eval "| response contents text timestamp |
"$package_dir/pharo/bin/pharo" --headless $package_dir/image/$PROJECT_NAME.image eval "| response contents downloads text timestamp |
response := ZnClient new
url:
'https://api.github.com/repos/openponk/$REPOSITORY_NAME/releases/tags/nightly';
'https://api.github.com/repos/openponk/plugins/releases/tags/nightly';
accept: ZnMimeType applicationJson;
setBearerAuthentication:
'$GITHUB_TOKEN';
token;
get.
contents := STONJSON fromString: response.
(contents includesKey: #assets) ifFalse: [ self error: 'Previous nightly build not found.
If this is first build of this repository, create pre-release named "nightly" by hand first.
Otherwise, this server response might help you:
', response asString].
downloads := ((contents at: #assets) sumNumbers: [ :each | each at: #download_count ]).
downloads isZero ifTrue: [ ^ 'No downloads of last nightly build - nothing to upload' ].
text := String streamContents: [ :s |
s << 'name,created_at,download_count'.
s lf.
Expand All @@ -30,19 +40,21 @@ unzip -q $PROJECT_NAME-$PLATFORM-$VERSION.zip
].
timestamp := DateAndTime now asString.
filename := ((timestamp first: 19) copyReplaceAll: ':' with: '') , '.csv'.
ZnClient new
url:
'https://api.github.com/repos/openponk/$REPOSITORY_NAME/contents/'
, timestamp , '.csv';
'https://api.github.com/repos/openponk/plugins/contents/'
, filename;
accept: ZnMimeType applicationJson;
setBearerAuthentication: '$GITHUB_TOKEN';
setBearerAuthentication: token;
entity: (ZnEntity
with: '{
\"content\":\"' , text asByteArray base64Encoded , '\",
\"message\":\"' , timestamp , '\",
\"branch\":\"dls\"
}'
type: ZnMimeType applicationJson);
put"
put.
^ 'Uploaded ', downloads asString, ' download count'"
57 changes: 30 additions & 27 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ on:
secrets:
WORKFLOW_ACCESS_TOKEN:
required: true
ACTIONS_READ_ACCESS_TOKEN:
required: true
schedule:
- cron: "42 23 31 12 *"

env:
REPOSITORY_NAME: '${{ github.event.repository.name }}'
REPOSITORY_NAME: ${{ github.event.repository.name }}
PROJECT_NAME: 'openponk-${{ github.event.repository.name }}'
VERSION: 'nightly'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: 'nightly'
cache-name: zip-cache
RUN_ID: ${{ github.run_id }}

Expand All @@ -34,9 +36,9 @@ jobs:
name: 'Build Linux'
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.0
uses: actions/checkout@v4.1.0
- name: Load SmalltalkCI environment
uses: hpi-swa/[email protected].2
uses: hpi-swa/[email protected].4
id: smalltalkci
with:
smalltalk-image: Pharo64-11
Expand All @@ -46,8 +48,10 @@ jobs:
timeout-minutes: 12
- name: Create zip
run: chmod u+x .github/scripts/build-linux.sh; ./.github/scripts/build-linux.sh
env:
ACTIONS_READ_ACCESS_TOKEN: ${{ secrets.ACTIONS_READ_ACCESS_TOKEN }}
- name: Cache zip
uses: actions/cache/save@v3.2.2
uses: actions/cache/save@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
Expand All @@ -59,9 +63,9 @@ jobs:
name: 'Build Mac'
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.0
uses: actions/checkout@v4.1.0
- name: Load SmalltalkCI environment
uses: hpi-swa/[email protected].2
uses: hpi-swa/[email protected].4
id: smalltalkci
with:
smalltalk-image: Pharo64-11
Expand All @@ -71,8 +75,10 @@ jobs:
timeout-minutes: 12
- name: Create zip
run: chmod u+x .github/scripts/build-mac.sh; ./.github/scripts/build-mac.sh
env:
ACTIONS_READ_ACCESS_TOKEN: ${{ secrets.ACTIONS_READ_ACCESS_TOKEN }}
- name: Cache zip
uses: actions/cache/save@v3.2.2
uses: actions/cache/save@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
Expand All @@ -84,9 +90,9 @@ jobs:
name: 'Build Windows'
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.0
uses: actions/checkout@v4.1.0
- name: Load SmalltalkCI environment
uses: hpi-swa/[email protected].2
uses: hpi-swa/[email protected].4
id: smalltalkci
with:
smalltalk-image: Pharo64-11
Expand All @@ -96,8 +102,10 @@ jobs:
timeout-minutes: 20
- name: Create zip
run: ./.github/scripts/build-win.ps1
env:
ACTIONS_READ_ACCESS_TOKEN: ${{ secrets.ACTIONS_READ_ACCESS_TOKEN }}
- name: Cache zip
uses: actions/cache/save@v3.2.2
uses: actions/cache/save@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
Expand All @@ -111,7 +119,7 @@ jobs:
steps:
- name: Get zip from cache
id: get-zip
uses: actions/cache/restore@v3.2.2
uses: actions/cache/restore@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
Expand All @@ -128,7 +136,7 @@ jobs:
steps:
- name: Get zip from cache
id: get-zip
uses: actions/cache/restore@v3.2.2
uses: actions/cache/restore@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
Expand All @@ -145,7 +153,7 @@ jobs:
steps:
- name: Get zip from cache
id: get-zip
uses: actions/cache/restore@v3.2.2
uses: actions/cache/restore@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
Expand All @@ -162,10 +170,10 @@ jobs:
PLATFORM: linux
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.0
uses: actions/checkout@v4.1.0
- name: Get zip from cache
id: get-zip
uses: actions/cache/restore@v3.2.2
uses: actions/cache/restore@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
Expand Down Expand Up @@ -197,15 +205,13 @@ jobs:
steps:
- name: Get zip from cache
id: get-zip
uses: actions/cache/restore@v3.2.2
uses: actions/cache/restore@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
- name: Get Release by Tag
id: get_release_by_tag
uses: jonfriesen/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
- name: Upload zip
Expand All @@ -226,15 +232,13 @@ jobs:
steps:
- name: Get zip from cache
id: get-zip
uses: actions/cache/restore@v3.2.2
uses: actions/cache/restore@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
- name: Get Release by Tag
id: get_release_by_tag
uses: jonfriesen/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
- name: Upload zip
Expand All @@ -255,15 +259,13 @@ jobs:
steps:
- name: Get zip from cache
id: get-zip
uses: actions/cache/restore@v3.2.2
uses: actions/cache/restore@v3.3.2
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
- name: Get Release by Tag
id: get_release_by_tag
uses: jonfriesen/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
- name: Upload zip
Expand All @@ -284,7 +286,7 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.0
uses: actions/checkout@v4.1.0
- name: Check list of repositories exists
id: check-file
run: test -f ./.github/dependent-repositories.txt || exit 1
Expand All @@ -301,9 +303,10 @@ jobs:
matrix: ${{fromJson(needs.create-dependent-matrix.outputs.matrix)}}
steps:
- name: Start ${{ matrix.repository }} build
uses: benc-uk/workflow-dispatch@v1.1.0
uses: benc-uk/workflow-dispatch@v1.2.2
with:
workflow: Nightly
repo: ${{ matrix.repository }}
ref: ${{ matrix.branch }}
token: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
inputs: '{ "build-dependent": "${{ matrix.build-dependent }}" }'
31 changes: 20 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ on:
release:
types: [published]
workflow_call:
secrets:
ACTIONS_READ_ACCESS_TOKEN:
required: true

env:
REPOSITORY_NAME: '${{ github.event.repository.name }}'
REPOSITORY_NAME: ${{ github.event.repository.name }}
PROJECT_NAME: 'openponk-${{ github.event.repository.name }}'
VERSION: ${{ github.event.release.tag_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.event.release.tag_name }}
RUN_ID: ${{ github.run_id }}

jobs:
Expand All @@ -19,8 +22,8 @@ jobs:
PLATFORM: ${{ github.job }}
name: 'Build Linux and upload zip'
steps:
- uses: actions/checkout@v2.4.0
- uses: hpi-swa/[email protected].2
- uses: actions/checkout@v4.1.0
- uses: hpi-swa/[email protected].4
id: smalltalkci
with:
smalltalk-image: Pharo64-11
Expand All @@ -30,9 +33,11 @@ jobs:
timeout-minutes: 12
- name: Create zip
run: chmod u+x .github/scripts/build-linux.sh; ./.github/scripts/build-linux.sh
env:
ACTIONS_READ_ACCESS_TOKEN: ${{ secrets.ACTIONS_READ_ACCESS_TOKEN }}
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
uses: bruceadams/get-release@v1.3.2
- name: Upload zip
id: upload-zip
uses: actions/[email protected]
Expand All @@ -48,8 +53,8 @@ jobs:
PLATFORM: ${{ github.job }}
name: 'Build Mac and upload zip'
steps:
- uses: actions/checkout@v2.4.0
- uses: hpi-swa/[email protected].2
- uses: actions/checkout@v4.1.0
- uses: hpi-swa/[email protected].4
id: smalltalkci
with:
smalltalk-image: Pharo64-11
Expand All @@ -59,9 +64,11 @@ jobs:
timeout-minutes: 12
- name: Create zip
run: chmod u+x .github/scripts/build-mac.sh; ./.github/scripts/build-mac.sh
env:
ACTIONS_READ_ACCESS_TOKEN: ${{ secrets.ACTIONS_READ_ACCESS_TOKEN }}
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
uses: bruceadams/get-release@v1.3.2
- name: Upload zip
id: upload-zip
uses: actions/[email protected]
Expand All @@ -77,8 +84,8 @@ jobs:
PLATFORM: ${{ github.job }}
name: 'Build Windows and upload zip'
steps:
- uses: actions/checkout@v2.4.0
- uses: hpi-swa/[email protected].2
- uses: actions/checkout@v4.1.0
- uses: hpi-swa/[email protected].4
id: smalltalkci
with:
smalltalk-image: Pharo64-11
Expand All @@ -88,9 +95,11 @@ jobs:
timeout-minutes: 20
- name: Create zip
run: ./.github/scripts/build-win.ps1
env:
ACTIONS_READ_ACCESS_TOKEN: ${{ secrets.ACTIONS_READ_ACCESS_TOKEN }}
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
uses: bruceadams/get-release@v1.3.2
- name: Upload zip
id: upload-zip
uses: actions/[email protected]
Expand Down
Empty file added .txt
Empty file.

0 comments on commit fbeb7a1

Please sign in to comment.