Skip to content

Commit

Permalink
chore: create release workflow for alpha
Browse files Browse the repository at this point in the history
Signed-off-by: Zvi Grinberg <[email protected]>
  • Loading branch information
zvigrinberg committed Sep 7, 2023
1 parent fd292ad commit f781fc9
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 1 deletion.
105 changes: 105 additions & 0 deletions .github/workflows/release-alpha.yml
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
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@RHEcosystemAppEng/exhort-javascript-api",
"version": "0.0.2-ea.21",
"version": "v0.0.2-alpha.0",
"description": "Code-Ready Dependency Analytics JavaScript API.",
"license": "Apache-2.0",
"homepage": "https://github.com/RHEcosystemAppEng/exhort-javascript-api#README.md",
Expand Down

0 comments on commit f781fc9

Please sign in to comment.