diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml new file mode 100644 index 00000000..8d39945d --- /dev/null +++ b/.github/workflows/publish-image.yml @@ -0,0 +1,34 @@ +name: Build and Publish Image + +on: + workflow_dispatch: # allows manual runs from the Actions tab + +env: + REGISTRY: ghcr.io + TOOL_NAME: 'bmxtools' + VERSION: '1.7.0' + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v6.0.2 + + - name: Log in to GHCR + uses: docker/login-action@v4.2.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v7.2.0 + with: + context: . + push: true + tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.TOOL_NAME }}:latest, ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.TOOL_NAME }}:${{ env.VERSION }} diff --git a/.gitignore b/.gitignore index 6fb0d664..d3a1e8dc 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ compile_commands.json CTestTestfile.cmake _deps out/ +.DS_Store diff --git a/docs/release.md b/docs/release.md index 6643817d..e6841a33 100644 --- a/docs/release.md +++ b/docs/release.md @@ -9,10 +9,11 @@ This describes the steps for making a release. * Go through the PRs since the last release and add each PR and descriptive text to the `Breaking changes`, `Features`, `Bug fixes` or `Build changes` sections * Update the versions in the 3 main CMakeLists.txt files in the `project` blocks, where `VERSION` has the form `.` * The files are [bmx CMakeLists.txt](../CMakeLists.txt), [libMXF CmakeLists.txt](../deps/libMXF/CMakeLists.txt) and [libMXFpp CmakeLists.txt](../deps/libMXFpp/CMakeLists.txt) -* Run the [Build & Test](https://github.com/ebu/bmx/actions/workflows/build_and_test.yml) workflow in GitHub Actions using the release branch and fix any build errors and warnings +* Update the version in the [Build and Publish Image](../.github/workflows/publish-image.yml) file, where `VERSION` has the form `..` +* Run the [Build & Test](../.github/workflows/build_and_test.yml) workflow in GitHub Actions using the release branch and fix any build errors and warnings * Check the [runner versions](https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners) (e.g. `windows-2019` and `macos-13`) in the [release.yml](../.github/workflows/release.yml) workflow file are still available * Select the oldest macOS version available to help with compatibility -* Run the [Release](https://github.com/ebu/bmx/actions/workflows/release.yml) workflow in GitHub Actions using the release branch to check it succeeds +* Run the [Release](../.github/workflows/release.yml) workflow in GitHub Actions using the release branch to check it succeeds * On the release branch, create a temporary tag and then delete the tag once the workflow succeeds: ```bash @@ -43,7 +44,7 @@ git push origin v${BMX_VERSION} ## Create the Release Packages -* Run the [Release](https://github.com/ebu/bmx/actions/workflows/release.yml) workflow in GitHub Actions +* Run the [Release](../.github/workflows/release.yml) workflow in GitHub Actions * Download the Artifacts and extract the individual source and binary zips for the release ## Create a GitHub Release @@ -54,35 +55,9 @@ git push origin v${BMX_VERSION} * Change the CHANGELOG link * Update the zip filenames with the new version * Update the compiler versions used for the binaries - * These can be found in the actions output in the `Win64 binary release` and `MacOS Universal binary release` build steps in the 2 jobs of the [Release](https://github.com/ebu/bmx/actions/workflows/release.yml) workflow in GitHub Actions + * These can be found in the actions output in the `Win64 binary release` and `MacOS Universal binary release` build steps in the 2 jobs of the [Release](../.github/workflows/release.yml) workflow in GitHub Actions * Upload the source and binary zips to the release ## Create a Docker Image for the GitHub Container Registry -* Acquire a Linux machine with Docker installed -* Build the `bmxtools` image and tag using the commands below - * `BMX_VERSION` should be set as before; note also the additional `.0` for the patch version. - -```bash -DOCKER_BUILDKIT=1 docker build --platform linux/amd64 -t bmxtools . -docker tag bmxtools ghcr.io/ebu/bmxtools:${BMX_VERSION}.0 -docker tag bmxtools ghcr.io/ebu/bmxtools:latest -``` - -* In your [GitHub settings](https://github.com/settings/tokens) to create tokens - * Select "Generate New Token" and "Generate new token (classic)" - * Change "Expiration" to 7 days - * Select "write:packages" (which will select "read:packages" and all of "repo") - * Select "Generate Token" - * Copy the token which you'll need to pass in when logging into the GitHub Docker registry -* Login into GHCR and push the image using the commands below - * Replace `` with your GitHub username - * Pass in the token when docker login requests it - * `BMX_VERSION` should be set as before; note also the additional `.0` for the patch version - -```bash -docker login ghcr.io --username -docker push ghcr.io/ebu/bmxtools:${BMX_VERSION}.0 -docker push ghcr.io/ebu/bmxtools:latest -docker logout ghcr.io -``` +* Run the [Build and Publish Image](../.github/workflows/publish-image.yml) workflow in GitHub actions on the release tag.