Skip to content

Commit

Permalink
ci: little update
Browse files Browse the repository at this point in the history
  • Loading branch information
flemzord committed Dec 6, 2023
1 parent ea88738 commit 3437916
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/actions/extract-in-tag/service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const value = process.argv[2];

const getValue = (string) => {
const value = string.match(/(?<=\/)[^\/]+(?=\/)/)[0];
const value = string.match(/([a-z].*)\/([a-z].*)\/([a-z].*)/)[2];
return value;
};

Expand Down
8 changes: 8 additions & 0 deletions .github/actions/extract-in-tag/type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const value = process.argv[2];

const getValue = (string) => {
const value = string.match(/([a-z].*)\/([a-z].*)\/([a-z].*)/)[1];
return value;
};

console.log(getValue(value));
18 changes: 9 additions & 9 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:
- synchronize

jobs:
Triage:
permissions:
contents: read
pull-requests: write
runs-on: formance-runner
steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
# Triage:
# permissions:
# contents: read
# pull-requests: write
# runs-on: formance-runner
# steps:
# - uses: actions/labeler@v5
# with:
# repo-token: "${{ secrets.GITHUB_TOKEN }}"

PR:
name: Check PR Title
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ name: Default - Release
on:
push:
tags:
- 'components/*/v*.*.*'
- '*/*/v*.*.*'

jobs:
Extract:
name: Extract
runs-on: "formance-runner"
outputs:
type: ${{ steps.extract3.outputs.type }}
service: ${{ steps.extract.outputs.service }}
version: ${{ steps.extract.outputs.version }}
version: ${{ steps.extract2.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -24,6 +25,9 @@ jobs:
- name: Extract version name
id: extract2
run: echo "version=$(node .github/actions/extract-in-tag/version.js ${{ github.ref_name }})" >> $GITHUB_OUTPUT
- name: Extract type name
id: extract3
run: echo "type=$(node .github/actions/extract-in-tag/type.js ${{ github.ref_name }})" >> $GITHUB_OUTPUT

Release:
runs-on: "formance-runner"
Expand All @@ -41,7 +45,17 @@ jobs:
registry: ghcr.io
username: "NumaryBot"
password: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- run: "earthly --no-output --allow-privileged --secret GITHUB_TOKEN=$GITHUB_TOKEN --secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY --secret FURY_TOKEN=$FURY_TOKEN --secret GORELEASER_KEY=$GORELEASER_KEY --secret SEGMENT_WRITE_KEY=$SEGMENT_WRITE_KEY +goreleaser --mode=release --component=${{ needs.Extract.outputs.service }}"
- run: >
earthly
--no-output
--allow-privileged
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
--secret SEGMENT_WRITE_KEY=$SEGMENT_WRITE_KEY
--secret GITHUB_TOKEN=$GITHUB_TOKEN
--secret FURY_TOKEN=$FURY_TOKEN
--secret GORELEASER_KEY=$GORELEASER_KEY
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
+goreleaser --mode=release --type=${{ needs.Extract.outputs.type }} --component=${{ needs.Extract.outputs.service }}
env:
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
Expand Down

0 comments on commit 3437916

Please sign in to comment.