Skip to content

Commit

Permalink
Modify container workflow to only publish on tags
Browse files Browse the repository at this point in the history
Also update which action versions to use, and remove scheduled builds.
  • Loading branch information
oyvindhagberg committed May 3, 2024
1 parent d45d257 commit eed5c15
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
paths-ignore:
- 'ci/**'
- 'README.md'
schedule:
- cron: '40 08 * * 1' # Run every week to get updated dependencies.
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
Expand All @@ -16,13 +14,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Docker build
run: docker build -t mreg .
- name: Save image
run: docker save mreg | gzip > mreg.tgz
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: mreg
path: mreg.tgz
Expand All @@ -47,10 +45,8 @@ jobs:
# Map the containerized port to localhost.
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: mreg
- name: Load image
Expand All @@ -67,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: mreg
- name: Load container image
Expand All @@ -77,7 +73,7 @@ jobs:
# but we want to use the newly built custom image
run: docker tag mreg ghcr.io/unioslo/mreg:latest
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install mreg-cli
Expand All @@ -90,7 +86,7 @@ jobs:
- name: Run the tests
run: mreg-cli-master/ci/run_testsuite_and_record.sh
- name: Upload the log as an artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: new_testsuite_log.json
path: mreg-cli-master/ci/new_testsuite_log.json
Expand All @@ -116,7 +112,7 @@ jobs:
- 5432:5432
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: mreg
- name: Load container image
Expand Down Expand Up @@ -148,16 +144,16 @@ jobs:
publish:
name: Publish
# only publish the image if this event was triggered on the master branch, and not by a pull request
if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}
# only publish the image if this event was triggered by a version tag
if: startsWith(github.ref, 'refs/tags/v')
needs: [test, mreg-cli, test-with-curl]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: mreg
- name: Load image
Expand Down

0 comments on commit eed5c15

Please sign in to comment.