Skip to content

Commit

Permalink
workflows/release.yaml: test version increase
Browse files Browse the repository at this point in the history
  • Loading branch information
julianvilas committed Jun 1, 2024
1 parent adfdfa5 commit 69cc685
Showing 1 changed file with 69 additions and 48 deletions.
117 changes: 69 additions & 48 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@ permissions:
contents: write

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version in SemVer format'
type: string
required: true
description:
description: 'Description of the release'
type: string
required: true
latest:
description: 'Is this the latest release?'
required: false
type: boolean
default: true

jobs:
build-and-publish:
Expand All @@ -15,49 +27,58 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install dependencies
- name: Increase version
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

- name: Create Release and Upload Assets
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const tag = process.env.GITHUB_REF;
const repo = process.env.GITHUB_REPOSITORY;
const [owner, repoName] = repo.split('/');
const releaseResponse = await github.rest.repos.createRelease({
owner: owner,
repo: repoName,
tag_name: tag,
name: `Release ${tag.replace('refs/tags/', '')}`,
});
const { id: id } = releaseResponse.data;
globber = await glob.create('dist/*');
const files = await globber.glob();
for (const file of files) {
const content = fs.readFileSync(file);
const name = path.basename(file);
await github.rest.repos.uploadReleaseAsset({
name: name,
owner: owner,
repo: repoName,
release_id: id,
data: content,
});
}
VERSION=${{ inputs.version#v }}"
sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" hackPyrateBus/__init__.py
sed -i "s/version = .*/version = '${VERSION}'/" setup.py
cat hackPyrateBus/__init__.py
cat setup.py
echo ${{ github.ref }}
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: 3.11

# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install build

# - name: Build package
# run: python -m build

# - name: Create Release and Upload Assets
# uses: actions/github-script@v7
# with:
# script: |
# const fs = require('fs');
# const path = require('path');

# const tag = process.env.GITHUB_REF;
# const repo = process.env.GITHUB_REPOSITORY;
# const [owner, repoName] = repo.split('/');

# const releaseResponse = await github.rest.repos.createRelease({
# owner: owner,
# repo: repoName,
# tag_name: tag,
# name: `Release ${tag.replace('refs/tags/', '')}`,
# });

# const { id: id } = releaseResponse.data;

# globber = await glob.create('dist/*');
# const files = await globber.glob();
# for (const file of files) {
# const content = fs.readFileSync(file);
# const name = path.basename(file);
# await github.rest.repos.uploadReleaseAsset({
# name: name,
# owner: owner,
# repo: repoName,
# release_id: id,
# data: content,
# });
# }

0 comments on commit 69cc685

Please sign in to comment.