Skip to content

Commit b12eae9

Browse files
authored
Update release.yml
1 parent 982085c commit b12eae9

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,49 @@
11
# This workflows will upload a Python Package using Twine when a release is created
22
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
43
name: Release to PyPi and DockerHub
54

65
on:
76
release:
87
types: [published, edited]
98

9+
# https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/
10+
permissions:
11+
contents: read
12+
id-token: write
13+
1014
jobs:
1115
publish:
12-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-22.04
1317
env:
1418
RELEASE_REF: ${{ github.ref }}
1519
steps:
16-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4.1.1
1721
- name: Set up Python
18-
uses: actions/setup-python@v1
22+
uses: actions/setup-python@v4
1923
with:
2024
python-version: "3.9"
25+
cache: pip
2126
- name: Inject slug/short variables
22-
uses: rlespinasse/github-slug-action@3.0.0
27+
uses: rlespinasse/github-slug-action@v4
2328
- name: Set Release Version
2429
run: |
2530
export RELEASE_VERSION=${GITHUB_REF_SLUG}
2631
echo -n $RELEASE_VERSION > ./version
2732
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
28-
export _DOCKER_TAG="unfor19/audacity-scripting:${RELEASE_VERSION}"
29-
echo "DOCKER_TAG=${_DOCKER_TAG}" >> $GITHUB_ENV
3033
- name: Validate Release Version
3134
run: |
3235
echo $GITHUB_ENV
3336
bash scripts/version_validation.sh
3437
- name: Install dependencies
3538
run: |
3639
python -m pip install --upgrade pip
37-
pip install setuptools==50.3.2 wheel==0.35.1 twine==3.1.1
38-
pip install -r requirements.txt
39-
- name: Test
40-
run: |
41-
python -m unittest discover -s tests -v
40+
pip install setuptools wheel twine
4241
- name: Build Package
4342
run: |
4443
python setup.py sdist bdist_wheel
4544
twine check ./dist/*
4645
- name: Publish to PyPi
4746
env:
48-
TWINE_USERNAME: ${{ secrets.PIP_USERNAME }}
49-
TWINE_PASSWORD: ${{ secrets.PIP_PASSWORD }}
5047
TWINE_NON_INTERACTIVE: true
5148
run: |
5249
twine upload ./dist/*
53-
- name: Build Docker Image
54-
run: |
55-
docker build . --file Dockerfile --tag "${DOCKER_TAG}"
56-
- name: Push to DockerHub
57-
run: |
58-
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin
59-
docker push "${DOCKER_TAG}" && echo "Pushed $DOCKER_TAG"

0 commit comments

Comments
 (0)