Added release job for OpenSSH workflow

This commit is contained in:
takeshix 2021-04-19 15:37:29 +02:00
parent 73ddc59fab
commit d64ea4e08f
2 changed files with 45 additions and 1 deletions

View file

@ -6,6 +6,8 @@ jobs:
name: Build OpenSSH x86
runs-on: ubuntu-latest
container: muslcc/x86_64:i686-linux-musl
outputs:
version: ${{ steps.build_openssh.outputs.PACKAGED_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v2
@ -85,3 +87,43 @@ jobs:
with:
name: ${{ steps.build_openssh.outputs.PACKAGED_NAME }}
path: ${{ steps.build_openssh.outputs.PACKAGED_NAME_PATH }}
create-release:
name: Create OpenSSH Release
runs-on: ubuntu-latest
needs: [build-x86, build-x86_64, build-armhf, build-aarch64]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare Environment
run: mkdir /tmp/releases
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: /tmp/releases
- name: List Artifacts
run: ls -laR /tmp/releases
- name: Tag Release
id: tag_release
run: |
set +e
if [ $(git tag "openssh-v${{ needs.build-x86.outputs.version }}") ];then
git push origin "openssh-v${{ needs.build-x86.outputs.version }}"
echo ::set-output name=NEW_RELEASE::"true"
else
echo "Tag for version ${{ needs.build-x86.outputs.version }} already exists. Skipping release creation."
echo ::set-output name=NEW_RELEASE::"false"
fi
- name: Create Release
uses: ncipollo/release-action@v1
if: ${{ steps.tag_release.outputs.NEW_RELEASE == 'true' }}
with:
name: openssh-v${{ needs.build-x86.outputs.version }}
tag: openssh-v${{ needs.build-x86.outputs.version }}
artifacts: "/tmp/releases/*/*"
token: ${{ secrets.GITHUB_TOKEN }}

View file

@ -43,6 +43,7 @@ main() {
exit 1
fi
OPENSSH_VERSION=$(get_version "${BUILD_DIRECTORY}/openssh-portable/ssh -V 2>&1 | awk '{print \$1}' | sed 's/,//g'")
version_number=$(echo "$OPENSSH_VERSION" | cut -d"_" -f2)
cp "${BUILD_DIRECTORY}/openssh-portable/ssh" "${OUTPUT_DIRECTORY}/ssh${OPENSSH_VERSION}"
cp "${BUILD_DIRECTORY}/openssh-portable/sshd" "${OUTPUT_DIRECTORY}/sshd${OPENSSH_VERSION}"
echo "[+] Finished building OpenSSH ${CURRENT_ARCH}"
@ -50,6 +51,7 @@ main() {
OPENSSH_VERSION=$(echo $OPENSSH_VERSION | sed 's/-//')
echo ::set-output name=PACKAGED_NAME::"${OPENSSH_VERSION}"
echo ::set-output name=PACKAGED_NAME_PATH::"/output/*"
echo ::set-output name=PACKAGED_VERSION::"${version_number}"
}
main