Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gmesika coti/actions #1

Merged
merged 7 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js/Python Package

on:
workflow_dispatch:
pull_request:
types: [ review_requested ]
jobs:
checkout:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

build-npm-package:
needs: update-version
if: steps.update-version.outcome == 'success' || always()
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci

build-python-package:
needs: update-version
runs-on: ubuntu-latest
steps:
- name: build release distributions
run: |
pip install setuptools
python setup.py sdist


58 changes: 26 additions & 32 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,17 @@ on:
workflow_dispatch:
release:
types: [ created ]
pull_request:
types: [ review_requested ]
jobs:
build:
checkout:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: npm ci

update-version:
needs: build
needs: checkout
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Update package.json version
run: |
TAG_NAME=$(echo ${{github.ref_name}})
Expand All @@ -47,49 +36,54 @@ jobs:
git add package.json
git add package-lock.json
git add setup.py
git commit -m "Update package.json version to $TAG_NAME"
git commit -m "Update package.json and setup.py version to $TAG_NAME"
git tag -f $TAG_NAME
git push --force origin $TAG_NAME
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-npm-package:
needs: update-version
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci

publish-npm-package:
needs: build-npm-package
runs-on: ubuntu-latest
steps:
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}


build-python-package:
needs: update-version
runs-on: ubuntu-latest
steps:
- name: build release distributions
run: |
pip install setuptools
python setup.py sdist

publish-python-package:
needs: build-python-package
runs-on: ubuntu-latest
steps:
- name: upload windows dists
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- update-version
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
permissions:
id-token: write
environment:
name: python-release-env
url: https://github.com

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1