-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: create release workflow for alpha
Signed-off-by: Zvi Grinberg <[email protected]>
- Loading branch information
1 parent
fd292ad
commit f781fc9
Showing
2 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
--- | ||
name: Stage | ||
|
||
env: | ||
# 🖊️ EDIT to change the image build settings. | ||
IMAGE_NAME: exhort-javascript-api | ||
IMAGE_REGISTRY: quay.io/ecosystem-appeng | ||
IMAGE_REGISTRY_USER: ${{ secrets.IMAGE_REGISTRY_USER }} | ||
IMAGE_REGISTRY_PASSWORD: ${{ secrets.IMAGE_REGISTRY_PASSWORD }} | ||
DOCKERFILE_PATH: ./docker-image/Dockerfiles/Dockerfile.alpha | ||
GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN: ${{ secrets.GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN }} | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- alpha | ||
paths: | ||
- "generated/**" | ||
- "src/**" | ||
- "package-lock.json" | ||
- "package.json" | ||
- "tsconfig.json" | ||
|
||
jobs: | ||
stage: | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'RHEcosystemAppEng' | ||
environment: staging | ||
name: Stage the project | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
with: | ||
ssh-key: ${{ secrets.DEPLOY_KEY }} | ||
|
||
- name: Install node 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
registry-url: 'https://npm.pkg.github.com' | ||
|
||
- name: Setup Java 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
cache: maven | ||
|
||
- name: Install project modules | ||
run: npm ci | ||
|
||
- name: Lint source files | ||
run: npm run lint | ||
|
||
- name: Run unit tests | ||
run: npm run test | ||
|
||
|
||
- name: Configure git | ||
run: | | ||
git config user.name "${{ github.actor }}" | ||
git config user.email "${{ github.actor }}@users.noreply.github.com" | ||
- name: Update package with new version | ||
id: bump | ||
run: | | ||
echo "version=$(npm version prerelease --no-git-tag-version --preid alpha)" >> "$GITHUB_OUTPUT" | ||
# - name: Install project modules | ||
# run: npm ci | ||
|
||
- name: Compile project | ||
run: npm run compile | ||
|
||
- name: Publish package | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npm publish | ||
|
||
- name: Commit and push package modifications | ||
run: | | ||
git add package.json | ||
git add package-lock.json | ||
git commit -m "build: updated package with ${{ steps.bump.outputs.version }} [skip ci]" | ||
git push | ||
- name: Create and push new tag | ||
run: | | ||
git tag ${{ steps.bump.outputs.version }} -m "${{ steps.bump.outputs.version }}" | ||
git push origin ${{ steps.bump.outputs.version }} | ||
- name: Create a release | ||
uses: actions/[email protected] | ||
with: | ||
github-token: ${{ secrets.STAGING_PAT }} | ||
script: | | ||
const repo_name = context.payload.repository.full_name | ||
const response = await github.request('POST /repos/' + repo_name + '/releases', { | ||
tag_name: '${{ steps.bump.outputs.version }}', | ||
name: '${{ steps.bump.outputs.version }}', | ||
prerelease: true, | ||
generate_release_notes: true | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters