Skip to content

Upgrade to Twine 5.0 #2504

Upgrade to Twine 5.0

Upgrade to Twine 5.0 #2504

Workflow file for this run

name: Continuous Delivery
on:
workflow_dispatch:
inputs:
versioning:
description: "Versioning"
default: minor
required: true
push:
branches:
- main
pull_request_target:
types: [labeled, opened, synchronize, reopened, closed]
pull_request:
types: [labeled, opened, synchronize, reopened, closed]
branches:
- main
jobs:
release:
name: Create releases or snapshot
runs-on: ubuntu-22.04
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'autorelease')) || (github.event_name == 'pull_request_target' && github.event.pull_request.merged == false && contains(github.event.pull_request.labels.*.name, 'snapshot'))
# Currently unused, we do everything within the same job.
outputs:
VERSION_TAG: ${{ steps.publish_release.outputs.VERSION_TAG }}
SNAPSHOT_OR_RELEASE: ${{ steps.publish_release.outputs.SNAPSHOT_OR_RELEASE }}
steps:
- name: Remove snapshot label
if: contains(github.event.pull_request.labels.*.name, 'snapshot')
run: |
curl --silent --fail \
-X DELETE \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: token ${{ github.token }}' \
'https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/snapshot'
- uses: actions/checkout@v3
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
with:
fetch-depth: 0
- uses: actions/checkout@v3
if: github.event_name == 'pull_request_target'
with:
fetch-depth: 0
# See: https://github.com/actions/checkout/issues/518
ref: "refs/pull/${{ github.event.number }}/merge"
# currently needed only for .npmrc to have a registry URL.
- uses: actions/setup-node@v1
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- uses: ./.github/actions/setup
- name: Configure git
run: |
git config --global user.email "silviogutierrez@gmail.com"
git config --global user.name "Silvio J. Gutierrez"
- name: Publish release
id: publish_release
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]
then
nix-shell --command "scripts/release.sh --versioning ${{ github.event.inputs.versioning }}"
cd website
scripts/deploy.sh
elif [ "${{ github.event.pull_request.merged }}" = "true" ] && [ "${{ contains(github.event.pull_request.labels.*.name, 'autorelease') }}" = "true" ]
then
nix-shell --command "scripts/release.sh --versioning patch"
cd website
scripts/deploy.sh
else
nix-shell --command "scripts/release.sh --versioning snapshot"
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Prepare docker context"
run: scripts/build-create-django-app-docker.sh
- name: Build and push
uses: docker/build-push-action@v2
with:
context: website_build_context
platforms: linux/amd64,linux/arm64
file: website_build_context/Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: silviogutierrez/reactivated:${{ steps.publish_release.outputs.VERSION_TAG }},silviogutierrez/reactivated:${{ steps.publish_release.outputs.SNAPSHOT_OR_RELEASE }}