diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index bed84c6..47d73e5 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -2,16 +2,13 @@ name: dev workflow -env: - IMAGE_NAME: ${{ github.repository }} - # Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master branch push: - branches: [ master, main, dev ] + branches: [ dev ] pull_request: - branches: [ master, main, dev ] + branches: [ dev ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -56,9 +53,6 @@ jobs: name: Create dev container runs-on: ubuntu-20.04 if: github.event_name != 'pull_request' - strategy: - matrix: - python-versions: [3.9] # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -67,7 +61,7 @@ jobs: - uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-versions }} + python-version: 3.9 - name: Install dependencies run: | @@ -78,20 +72,23 @@ jobs: run: >- poetry build - - name: build container - id: docker_build - run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 - - name: log in to container registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: push container image - run: | - IMAGE_ID=ghcr.io/$IMAGE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $IMAGE_NAME $IMAGE_ID:dev - docker push $IMAGE_ID:dev + - name: Build and push dev + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/${{ github.repository }}:dev \ No newline at end of file diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml deleted file mode 100644 index 8f63a20..0000000 --- a/.github/workflows/preview.yml +++ /dev/null @@ -1,50 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: stage & preview workflow - -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [ master, main ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - publish_dev_build: - runs-on: ubuntu-latest - - strategy: - matrix: - python-versions: [ 3.9 ] - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-versions }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install poetry tox tox-gh-actions - - - name: test with tox - run: - tox - - - name: Build wheels and source tarball - run: | - poetry version $(poetry version --short)-dev.$GITHUB_RUN_NUMBER - poetry version --short - poetry build - - - name: publish to Test PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN}} - repository_url: https://test.pypi.org/legacy/ - skip_existing: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7dee663..0efb2d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,9 +12,6 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -env: - IMAGE_NAME: ${{ github.repository }} - # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "release" @@ -22,10 +19,6 @@ jobs: name: Create Release runs-on: ubuntu-20.04 - strategy: - matrix: - python-versions: [3.9] - # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Get version from tag @@ -46,7 +39,7 @@ jobs: - uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-versions }} + python-version: 3.9 - name: Install dependencies run: | @@ -61,12 +54,26 @@ jobs: run: >- ls -l - - name: build container - id: docker_build - run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 - - name: log in to container registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push dev + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/${{ github.repository }}:$VERSION, ghcr.io/${{ github.repository }}:latest - name: create github release id: create_release @@ -79,26 +86,6 @@ jobs: draft: false prerelease: false - - name: push container image - run: | - IMAGE_ID=ghcr.io/$IMAGE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - # Use Docker `latest` tag convention - [ "$VERSION" == "master" ] && VERSION=latest - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $IMAGE_NAME $IMAGE_ID:$VERSION - docker tag $IMAGE_NAME $IMAGE_ID:latest - docker push $IMAGE_ID:$VERSION - docker push $IMAGE_ID:latest - - - name: publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: