1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
name: release
on:
push:
tags:
- 'v*.*.*'
jobs:
release_assets:
name: release_assets
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow --tags --force
- name: Check if release is needed because tag matches latest annotated
env:
GITHUB_REF: ${{github.ref}}
run: |
GETVERSION="$(./scripts/get-version)"
GITTAG="${GITHUB_REF#refs/tags/v*}"
if [ "$GETVERSION" == "$GITTAG" ]
then
echo "do_release=true" >> $GITHUB_ENV
else
echo "Skipping because $GETVERSION did not match $GITTAG"
fi
- name: Make dist tarball and rpm packages
if: env.do_release
env:
OS_TYPE: rockylinux
OS_VERSION: 8
HIDE_DIST: true
GO_ARCH: linux-amd64
run: |
# Move the source directory down a level to separate it
# from later builds; the docker build runs privileged and
# changes the ownership of the files.
set -x
mkdir rpmdir
shopt -s extglob
mv .??* !(rpmdir) rpmdir
cd rpmdir
./scripts/ci-docker-run
cp *.tar.gz *.rpm ..
cd ..
- name: Make standard deb packages
if: env.do_release
env:
OS_TYPE: debian
OS_VERSION: 11
GO_ARCH: linux-amd64
run: |
# Make a new copy of the source files for this build
set -x
tar xf apptainer-*.tar.gz
cd `basename apptainer-*.tar.gz .tar.gz`
./scripts/ci-docker-run
cp *.deb ..
cd ..
- name: Make trixie deb packages
if: env.do_release
env:
OS_TYPE: debian
# once released, this version should change to 13
OS_VERSION: trixie
GO_ARCH: linux-amd64
run: |
# Make another new copy of the source files for this build
set -x
sudo rm -rf `basename apptainer-*.tar.gz .tar.gz`
tar xf apptainer-*.tar.gz
cd `basename apptainer-*.tar.gz .tar.gz`
./scripts/ci-docker-run
for d in *.deb; do cp $d ../`echo $d|sed 's/\(_[^_]*$\)/-trixie+\1/'`; done
cd ..
- name: Release
if: env.do_release
uses: softprops/action-gh-release@v1
with:
files: |
*.tar.gz
*.rpm
*.deb
release_container_images:
name: release_container_images
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow --tags --force
- name: Check if release is needed because tag matches latest annotated
env:
GITHUB_REF: ${{github.ref}}
run: |
GETVERSION="$(./scripts/get-version)"
GITTAG="${GITHUB_REF#refs/tags/v*}"
if [ "$GETVERSION" == "$GITTAG" ]
then
echo "do_release=true" >> $GITHUB_ENV
echo "git_tag=$GITTAG" >> $GITHUB_ENV
else
echo "Skipping because $GETVERSION did not match $GITTAG"
fi
- name: Set up qemu
if: env.do_release
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: env.do_release
uses: docker/setup-buildx-action@v3
- name: Docker meta
if: env.do_release
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/apptainer/apptainer
tags: |
type=semver,pattern={{version}}
- name: Login to ghcr.io
if: env.do_release
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get golang version
id: min-go-version
run: echo "GOLANG_VERSION=$(scripts/get-min-go-version)" >> "$GITHUB_OUTPUT"
- name: Build and push
if: env.do_release
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'push tag' }}
file: dist/docker/Dockerfile
build-args: |
VERSION=${{ env.git_tag }}
GOLANG_VERSION=${{ steps.min-go-version.outputs.GOLANG_VERSION }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
|