mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00

# Aider chat conversation: USER: what is github.ref? ASSISTANT: In GitHub Actions, `github.ref` is a context variable that refers to the branch or tag name that triggered the workflow run. For example, if you push a commit to the `main` branch, `github.ref` will be `refs/heads/main`. If you create a tag named `v1.0.0`, `github.ref` will be `refs/tags/v1.0.0`. In your workflow file, you're using `github.ref` to tag the Docker image. This means that the Docker image will be tagged with the name of the branch or tag that triggered the workflow run. However, since you're triggering the workflow on tag creation (`on: push: tags: - 'v*'`), `github.ref` will always be the name of the tag. If you create a tag named `v1.0.0`, the Docker image will be tagged as `v1.0.0`. USER: the Dockerfile is in the docker/ subdir. ASSISTANT: If your Dockerfile is in the `docker/` subdirectory, you need to specify this in the `context` and `file` parameters of the `docker/build-push-action` action in your GitHub Actions workflow file. The `context` parameter is the path to the directory that contains the Dockerfile. The `file` parameter is the path to the Dockerfile. Here are the changes you need to make to the `.github/workflows/release.yml` file: ```yaml .github/workflows/release.yml <<<<<<< HEAD - name: Build and push Docker image uses: docker/build-push-action@v2 with: context: . push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/aider:${{ github.ref }} ======= - name: Build and push Docker image uses: docker/build-push-action@v2 with: context: . file: ./docker/Dockerfile push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/aider:${{ github.ref }} >>>>>>> updated ``` This will tell the `docker/build-push-action` action to look for the Dockerfile in the `docker/` subdirectory.
45 lines
1 KiB
YAML
45 lines
1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build_and_publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.x
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install setuptools wheel twine
|
|
|
|
- name: Build and publish
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
run: |
|
|
python setup.py sdist bdist_wheel
|
|
twine upload dist/*
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: ./docker/Dockerfile
|
|
push: true
|
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/aider:${{ github.ref }}
|